<html>
 <head>
  <meta charset="utf-8"/>
  <meta content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" name="viewport"/>
  <title>
   MongoDB 极简实践入门  | 数螺 | NAUT IDEA
  </title>
  <link href="http://cdn.bootcss.com/bootstrap/3.3.6/css/bootstrap-theme.min.css" rel="stylesheet"/>
  <link href="http://cdn.bootcss.com/bootstrap/3.3.6/css/bootstrap.min.css" rel="stylesheet"/>
  <style type="text/css">
   #xmain img {
                  max-width: 100%;
                  display: block;
                  margin-top: 10px;
                  margin-bottom: 10px;
                }

                #xmain p {
                    line-height:150%;
                    font-size: 16px;
                    margin-top: 20px;
                }

                #xmain h2 {
                    font-size: 24px;
                }

                #xmain h3 {
                    font-size: 20px;
                }

                #xmain h4 {
                    font-size: 18px;
                }


                .header {
	           background-color: #0099ff;
	           color: #ffffff;
	           margin-bottom: 20px;
	        }

	        .header p {
                  margin: 0px;
                  padding: 10px 0;
                  display: inline-block;  
                  vertical-align: middle;
                  font-size: 16px;
               }

               .header a {
                 color: white;
               }

              .header img {
                 height: 25px;
              }
  </style>
  <script src="http://cdn.bootcss.com/jquery/3.0.0/jquery.min.js">
  </script>
  <script src="http://nautstatic-10007657.file.myqcloud.com/static/css/readability.min.js" type="text/javascript">
  </script>
  <script type="text/javascript">
   $(document).ready(function() {
                 var loc = document.location;
                 var uri = {
                  spec: "http://dataunion.org/5572.html",
                  host: "http://dataunion.org",
                  prePath: "http://dataunion.org",
                  scheme: "http",
                  pathBase: "http://dataunion.org/"
                 };
    
                 var documentClone = document.cloneNode(true);
                 var article = new Readability(uri, documentClone).parse();
     
                 document.getElementById("xmain").innerHTML = article.content;
                });
  </script>
  <!-- 1466459266: Accept with keywords: (title(0.0):社区,入门,数盟, topn(0.233333333333):社区,表格,数盟,条目,查找,文件,标签,数据库,形式,电影,名字,例子,文档,文章,基础架构,排序,数据,教程,项目,用户,标题,集合,声明,语句,赞数,表单,文件夹,评论,时候,文本).-->
 </head>
 <body onload="">
  <div class="header">
   <div class="container">
    <div class="row">
     <div class="col-xs-6 col-sm-6 text-left">
      <a href="/databee">
       <img src="http://nautidea-10007657.cos.myqcloud.com/logo_white.png"/>
      </a>
      <a href="/databee">
       <p>
        数螺
       </p>
      </a>
     </div>
     <div class="hidden-xs col-sm-6 text-right">
      <p>
       致力于数据科学的推广和知识传播
      </p>
     </div>
    </div>
   </div>
  </div>
  <div class="container text-center">
   <h1>
    MongoDB 极简实践入门
   </h1>
  </div>
  <div class="container" id="xmain">
   ﻿﻿
   <title>
    MongoDB 极简实践入门 | 数盟社区
   </title>
   <!-- All in One SEO Pack 2.2.7.6.2 by Michael Torbert of Semper Fi Web Design[32,61] -->
   <!-- /all in one seo pack -->
   <!--
<div align="center">
<a href="http://strata.oreilly.com.cn/hadoop-big-data-cn?cmp=mp-data-confreg-home-stcn16_dataunion_pc" target="_blank"><img src="http://dataunion.org/wp-content/uploads/2016/05/stratabj.jpg"/ ></a>
</div>
-->
   <header id="header-web">
    <div class="header-main">
     <hgroup class="logo">
      <h1>
       <a href="http://dataunion.org/" rel="home" title="数盟社区">
        <img src="http://dataunion.org/wp-content/themes/yzipi/images/logo.png"/>
       </a>
      </h1>
     </hgroup>
     <!--logo-->
     <nav class="header-nav">
      <ul class="menu" id="menu-%e4%b8%bb%e8%8f%9c%e5%8d%95">
       <li class="menu-item menu-item-type-taxonomy menu-item-object-category menu-item-has-children menu-item-71" id="menu-item-71">
        <a href="http://dataunion.org/category/events" title="events">
         活动
        </a>
        <ul class="sub-menu">
         <li class="menu-item menu-item-type-post_type menu-item-object-page menu-item-22457" id="menu-item-22457">
          <a href="http://dataunion.org/2016timeline">
           2016档期
          </a>
         </li>
         <li class="menu-item menu-item-type-taxonomy menu-item-object-category menu-item-22459" id="menu-item-22459">
          <a href="http://dataunion.org/category/parterc">
           合作会议
          </a>
         </li>
        </ul>
       </li>
       <li class="menu-item menu-item-type-taxonomy menu-item-object-category current-post-ancestor menu-item-has-children menu-item-20869" id="menu-item-20869">
        <a href="http://dataunion.org/category/tech" title="articles">
         文章
        </a>
        <ul class="sub-menu">
         <li class="menu-item menu-item-type-taxonomy menu-item-object-category current-post-ancestor current-menu-parent current-post-parent menu-item-20867" id="menu-item-20867">
          <a href="http://dataunion.org/category/tech/base" title="base">
           基础架构
          </a>
         </li>
         <li class="menu-item menu-item-type-taxonomy menu-item-object-category menu-item-3302" id="menu-item-3302">
          <a href="http://dataunion.org/category/tech/ai" title="ai">
           人工智能
          </a>
         </li>
         <li class="menu-item menu-item-type-taxonomy menu-item-object-category menu-item-3303" id="menu-item-3303">
          <a href="http://dataunion.org/category/tech/analysis" title="analysis">
           数据分析
          </a>
         </li>
         <li class="menu-item menu-item-type-taxonomy menu-item-object-category menu-item-21920" id="menu-item-21920">
          <a href="http://dataunion.org/category/tech/dm">
           数据挖掘
          </a>
         </li>
         <li class="menu-item menu-item-type-taxonomy menu-item-object-category menu-item-3314" id="menu-item-3314">
          <a href="http://dataunion.org/category/tech/viz" title="viz">
           可视化
          </a>
         </li>
         <li class="menu-item menu-item-type-taxonomy menu-item-object-category menu-item-3305" id="menu-item-3305">
          <a href="http://dataunion.org/category/tech/devl" title="devl">
           编程语言
          </a>
         </li>
        </ul>
       </li>
       <li class="menu-item menu-item-type-taxonomy menu-item-object-category menu-item-has-children menu-item-20876" id="menu-item-20876">
        <a href="http://dataunion.org/category/industry">
         行业
        </a>
        <ul class="sub-menu">
         <li class="menu-item menu-item-type-taxonomy menu-item-object-category menu-item-16328" id="menu-item-16328">
          <a href="http://dataunion.org/category/industry/case" title="case">
           行业应用
          </a>
         </li>
         <li class="menu-item menu-item-type-taxonomy menu-item-object-category menu-item-2112" id="menu-item-2112">
          <a href="http://dataunion.org/category/industry/demo" title="demo">
           Demo展示
          </a>
         </li>
         <li class="menu-item menu-item-type-taxonomy menu-item-object-category menu-item-21562" id="menu-item-21562">
          <a href="http://dataunion.org/category/industry/news">
           行业资讯
          </a>
         </li>
        </ul>
       </li>
       <li class="menu-item menu-item-type-taxonomy menu-item-object-category menu-item-311" id="menu-item-311">
        <a href="http://dataunion.org/category/sources" title="sources">
         资源
        </a>
       </li>
       <li class="menu-item menu-item-type-taxonomy menu-item-object-category menu-item-20870" id="menu-item-20870">
        <a href="http://dataunion.org/category/books" title="book">
         图书
        </a>
       </li>
       <li class="menu-item menu-item-type-taxonomy menu-item-object-category menu-item-21363" id="menu-item-21363">
        <a href="http://dataunion.org/category/training">
         课程
        </a>
       </li>
       <li class="menu-item menu-item-type-taxonomy menu-item-object-category menu-item-has-children menu-item-21853" id="menu-item-21853">
        <a href="http://dataunion.org/category/jobs">
         职位
        </a>
        <ul class="sub-menu">
         <li class="menu-item menu-item-type-taxonomy menu-item-object-category menu-item-22050" id="menu-item-22050">
          <a href="http://dataunion.org/category/career">
           职业规划
          </a>
         </li>
        </ul>
       </li>
      </ul>
     </nav>
     <!--header-nav-->
    </div>
   </header>
   <!--header-web-->
   <div id="main">
    <div id="soutab">
     <form action="http://dataunion.org/" class="search" method="get">
     </form>
    </div>
    <div id="container">
     <nav id="mbx">
      当前位置：
      <a href="http://dataunion.org">
       首页
      </a>
      &gt;
      <a href="http://dataunion.org/category/tech">
       文章
      </a>
      &gt;
      <a href="http://dataunion.org/category/tech/base">
       基础架构
      </a>
      &gt;  正文
     </nav>
     <!--mbx-->
     <article class="content">
      <header align="centre" class="contenttitle">
       <div class="mscc">
        <h1 class="mscctitle">
         <a href="http://dataunion.org/5572.html">
          MongoDB 极简实践入门
         </a>
        </h1>
        <address class="msccaddress ">
         <em>
          2,870 次阅读 -
         </em>
         <a href="http://dataunion.org/category/tech/base" rel="category tag">
          基础架构
         </a>
        </address>
       </div>
      </header>
      <div class="content-text">
       <h4>
        1. 为什么用MongoDB？
       </h4>
       <p>
        传统的计算机应用大多使用关系型数据库来存储数据，比如大家可能熟悉的MySql, Sqlite等等，它的特点是数据以表格(table)的形式储存起来的。数据库由一张张排列整齐的表格构成，就好像一个Excel表单一样，每个表格会有若干列，比如一个学生信息表，可能包含学号、姓名、性别、入学年份、高考成绩、籍贯等等。而表格的每一排，则是一个个学生的具体信息。在企业级应用和前互联网时代，关系型数据库几乎是不二选择。关系型数据库的特点是有整齐划一的组织，很方便对数据进行描述、插入、搜索。
       </p>
       <p>
        想象有一个传统的网上服装商店吧，它的主要的数据可能是储存在一张叫products的表单里，表单可能包含这些列：商品编号(ID)、名称(Name)、商家(brand)、主目录(cate)、子目录(sub-cat)、零售价(price)、是否促销(promotion)等等。如果有一个用户想要查找所有价格低于300元的正在促销的鞋子的编号和名称，则可以执行类似于以下的SQL语句：
       </p>
       <!-- Crayon Syntax Highlighter v_2.7.2_beta -->
       <div class="crayon-syntax crayon-theme-classic crayon-font-monaco crayon-os-pc print-yes notranslate" data-settings=" minimize scroll-mouseover" id="crayon-5768647c9c523855089800" style=" margin-top: 12px; margin-bottom: 12px; font-size: 12px !important; line-height: 15px !important;">
        <div class="crayon-toolbar" data-settings=" mouseover overlay hide delay" style="font-size: 12px !important;height: 18px !important; line-height: 18px !important;">
         <span class="crayon-title">
         </span>
         <div class="crayon-tools" style="font-size: 12px !important;height: 18px !important; line-height: 18px !important;">
          <div class="crayon-button crayon-nums-button" title="切换是否显示行编号">
           <div class="crayon-button-icon">
           </div>
          </div>
          <div class="crayon-button crayon-plain-button" title="纯文本显示代码">
           <div class="crayon-button-icon">
           </div>
          </div>
          <div class="crayon-button crayon-wrap-button" title="切换自动换行">
           <div class="crayon-button-icon">
           </div>
          </div>
          <div class="crayon-button crayon-expand-button" title="点击展开代码">
           <div class="crayon-button-icon">
           </div>
          </div>
          <div class="crayon-button crayon-copy-button" title="复制代码">
           <div class="crayon-button-icon">
           </div>
          </div>
          <div class="crayon-button crayon-popup-button" title="在新窗口中显示代码">
           <div class="crayon-button-icon">
           </div>
          </div>
         </div>
        </div>
        <div class="crayon-info" style="min-height: 16.8px !important; line-height: 16.8px !important;">
        </div>
        <div class="crayon-plain-wrap">
         <textarea class="crayon-plain print-no" data-settings="dblclick" readonly="" style="-moz-tab-size:4; -o-tab-size:4; -webkit-tab-size:4; tab-size:4; font-size: 12px !important; line-height: 15px !important;" wrap="soft">
          SELECT ID, name FROM products WHERE cate='shoes' AND price&amp;lt;300 and AND promotion=true;
         </textarea>
        </div>
        <div class="crayon-main" style="">
         <table class="crayon-table">
          <tbody>
           <tr class="crayon-row">
            <td class="crayon-nums " data-settings="show">
             <div class="crayon-nums-content" style="font-size: 12px !important; line-height: 15px !important;">
              <div class="crayon-num" data-line="crayon-5768647c9c523855089800-1">
               1
              </div>
              <div class="crayon-num crayon-striped-num" data-line="crayon-5768647c9c523855089800-2">
               2
              </div>
             </div>
            </td>
            <td class="crayon-code">
             <div class="crayon-pre" style="font-size: 12px !important; line-height: 15px !important; -moz-tab-size:4; -o-tab-size:4; -webkit-tab-size:4; tab-size:4;">
              <div class="crayon-line" id="crayon-5768647c9c523855089800-1">
               <span class="crayon-e">
                SELECT
               </span>
               <span class="crayon-v">
                ID
               </span>
               <span class="crayon-sy">
                ,
               </span>
               <span class="crayon-h">
               </span>
               <span class="crayon-e">
                name
               </span>
               <span class="crayon-e">
                FROM
               </span>
               <span class="crayon-e">
                products
               </span>
               <span class="crayon-e">
                WHERE
               </span>
               <span class="crayon-v">
                cate
               </span>
               <span class="crayon-o">
                =
               </span>
               <span class="crayon-s">
                'shoes'
               </span>
               <span class="crayon-h">
               </span>
               <span class="crayon-st">
                AND
               </span>
               <span class="crayon-h">
               </span>
               <span class="crayon-v">
                price
               </span>
               <span class="crayon-o">
                &amp;
               </span>
               <span class="crayon-v">
                lt
               </span>
               <span class="crayon-sy">
                ;
               </span>
               <span class="crayon-cn">
                300
               </span>
               <span class="crayon-h">
               </span>
               <span class="crayon-st">
                and
               </span>
               <span class="crayon-h">
               </span>
               <span class="crayon-st">
                AND
               </span>
               <span class="crayon-h">
               </span>
               <span class="crayon-v">
                promotion
               </span>
               <span class="crayon-o">
                =
               </span>
               <span class="crayon-t">
                true
               </span>
               <span class="crayon-sy">
                ;
               </span>
              </div>
              <div class="crayon-line crayon-striped-line" id="crayon-5768647c9c523855089800-2">
              </div>
             </div>
            </td>
           </tr>
          </tbody>
         </table>
        </div>
       </div>
       <!-- [Format Time: 0.0013 seconds] -->
       <p>
        SQL具备了强大了的深度查询能力，能满足各式各样的查询要求。而如果要对数据进行添加和删除，成本也是非常低的。这些是SQL的优势之一， 但随着互联网的兴起以及数据形式的多样化，四平八稳的SQL表单在一些领域渐渐显现出它的劣势。让我们通过一个例子来说明。考虑一个博客后台系统，如果我们用关系型数据库为每篇博客(article)建一个表单的话，这个表单大概会包括以下这些列：
       </p>
       <table>
        <thead>
         <tr>
          <th>
           ID
          </th>
          <th align="center">
           Title
          </th>
          <th align="center">
           Description
          </th>
          <th align="center">
           Author
          </th>
          <th align="center">
           Content
          </th>
          <th align="center">
           Likes
          </th>
         </tr>
        </thead>
        <tbody>
         <tr>
          <td>
           A_1
          </td>
          <td align="center">
           Title1
          </td>
          <td align="center">
           Political Article
          </td>
          <td align="center">
           Joe
          </td>
          <td align="center">
           Content 1
          </td>
          <td align="center">
           12
          </td>
         </tr>
         <tr>
          <td>
           A_2
          </td>
          <td align="center">
           Title2
          </td>
          <td align="center">
           Humorous Story
          </td>
          <td align="center">
           Sam
          </td>
          <td align="center">
           Content 2
          </td>
          <td align="center">
           50
          </td>
         </tr>
        </tbody>
       </table>
       <p>
        这时候用SQL数据库来存储是非常方便的，但假如我们要位每篇文章添加评论功能，会发现每篇文章可能要多篇评论，而且这个数目是动态变化的，而且每篇评论还包括好几项内容：评论的人、评论的时间、以及评论内容。这时候要将这些内容都塞进上述的那个表，就显得很困难。通常的做法是为评论(comment)单独建一个表：
       </p>
       <table>
        <thead>
         <tr>
          <th>
           ID
          </th>
          <th align="center">
           Author
          </th>
          <th align="center">
           Time
          </th>
          <th align="center">
           Content
          </th>
          <th align="center">
           Article
          </th>
         </tr>
        </thead>
        <tbody>
         <tr>
          <td>
           C_1
          </td>
          <td align="center">
           Anna
          </td>
          <td align="center">
           2014-12-26 08:23
          </td>
          <td align="center">
           Really good articles!
          </td>
          <td align="center">
           A_1
          </td>
         </tr>
         <tr>
          <td>
           C_2
          </td>
          <td align="center">
           David
          </td>
          <td align="center">
           2014-12-25 09:30
          </td>
          <td align="center">
           I like it!
          </td>
          <td align="center">
           A_1
          </td>
         </tr>
        </tbody>
       </table>
       <p>
        类似地，每篇文章可能会有若干标签(tags)。标签本身又是一个表单：
       </p>
       <table>
        <thead>
         <tr>
          <th>
           ID
          </th>
          <th align="center">
           Category
          </th>
          <th align="center">
           Tags
          </th>
          <th align="center">
           Content
          </th>
          <th align="center">
           Article
          </th>
         </tr>
        </thead>
        <tbody>
         <tr>
          <td>
           T_1
          </td>
          <td align="center">
           Anna
          </td>
          <td align="center">
           2014-12-26 08:23
          </td>
          <td align="center">
           Really good articles!
          </td>
          <td align="center">
           A_1
          </td>
         </tr>
         <tr>
          <td>
           T_2
          </td>
          <td align="center">
           David
          </td>
          <td align="center">
           2014-12-25 09:30
          </td>
          <td align="center">
           I like it!
          </td>
          <td align="center">
           A_2
          </td>
         </tr>
        </tbody>
       </table>
       <p>
        而博客的表格则要通过foreign key跟这些相关联的表格联系起来(可能还包括作者、出版社等其它表格)。这样一来，当我们做查询的时候，比如说，“找出评论数不少于3的标签为‘政治评论’的作者为Sam的文章”，就会涉及到复杂的跨表查询，需要大量使用
        <code>
         join
        </code>
        语句。这种跨表查询不仅降低了查询速度，而且这些语句写起来也不简单。
       </p>
       <p>
        那么，如果用MongoDB数据库来实现，可以如何设计数据模型呢？很简单，像下面这样
        <a href="http://www.tutorialspoint.com/mongodb/mongodb_data_modeling.htm">
         [1]
        </a>
        ：
       </p>
       <!-- Crayon Syntax Highlighter v_2.7.2_beta -->
       <div class="crayon-syntax crayon-theme-classic crayon-font-monaco crayon-os-pc print-yes notranslate" data-settings=" minimize scroll-mouseover" id="crayon-5768647c9c536524965631" style=" margin-top: 12px; margin-bottom: 12px; font-size: 12px !important; line-height: 15px !important;">
        <div class="crayon-toolbar" data-settings=" mouseover overlay hide delay" style="font-size: 12px !important;height: 18px !important; line-height: 18px !important;">
         <span class="crayon-title">
         </span>
         <div class="crayon-tools" style="font-size: 12px !important;height: 18px !important; line-height: 18px !important;">
          <div class="crayon-button crayon-nums-button" title="切换是否显示行编号">
           <div class="crayon-button-icon">
           </div>
          </div>
          <div class="crayon-button crayon-plain-button" title="纯文本显示代码">
           <div class="crayon-button-icon">
           </div>
          </div>
          <div class="crayon-button crayon-wrap-button" title="切换自动换行">
           <div class="crayon-button-icon">
           </div>
          </div>
          <div class="crayon-button crayon-expand-button" title="点击展开代码">
           <div class="crayon-button-icon">
           </div>
          </div>
          <div class="crayon-button crayon-copy-button" title="复制代码">
           <div class="crayon-button-icon">
           </div>
          </div>
          <div class="crayon-button crayon-popup-button" title="在新窗口中显示代码">
           <div class="crayon-button-icon">
           </div>
          </div>
         </div>
        </div>
        <div class="crayon-info" style="min-height: 16.8px !important; line-height: 16.8px !important;">
        </div>
        <div class="crayon-plain-wrap">
         <textarea class="crayon-plain print-no" data-settings="dblclick" readonly="" style="-moz-tab-size:4; -o-tab-size:4; -webkit-tab-size:4; tab-size:4; font-size: 12px !important; line-height: 15px !important;" wrap="soft">
          _id: POST_ID
   title: TITLE_OF_POST, 
   description: POST_DESCRIPTION,
   author: POST_BY,
   tags: [TAG1, TAG2, TAG3],
   likes: TOTAL_LIKES, 
   comments: [  
      {
         user:'COMMENT_BY',
         message: TEXT,
         dateCreated: DATE_TIME,
      },
      {
         user:'COMMENT_BY',
         message: TEXT,
         dateCreated: DATE_TIME,
      }
   ]
         </textarea>
        </div>
        <div class="crayon-main" style="">
         <table class="crayon-table">
          <tbody>
           <tr class="crayon-row">
            <td class="crayon-nums " data-settings="show">
             <div class="crayon-nums-content" style="font-size: 12px !important; line-height: 15px !important;">
              <div class="crayon-num" data-line="crayon-5768647c9c536524965631-1">
               1
              </div>
              <div class="crayon-num crayon-striped-num" data-line="crayon-5768647c9c536524965631-2">
               2
              </div>
              <div class="crayon-num" data-line="crayon-5768647c9c536524965631-3">
               3
              </div>
              <div class="crayon-num crayon-striped-num" data-line="crayon-5768647c9c536524965631-4">
               4
              </div>
              <div class="crayon-num" data-line="crayon-5768647c9c536524965631-5">
               5
              </div>
              <div class="crayon-num crayon-striped-num" data-line="crayon-5768647c9c536524965631-6">
               6
              </div>
              <div class="crayon-num" data-line="crayon-5768647c9c536524965631-7">
               7
              </div>
              <div class="crayon-num crayon-striped-num" data-line="crayon-5768647c9c536524965631-8">
               8
              </div>
              <div class="crayon-num" data-line="crayon-5768647c9c536524965631-9">
               9
              </div>
              <div class="crayon-num crayon-striped-num" data-line="crayon-5768647c9c536524965631-10">
               10
              </div>
              <div class="crayon-num" data-line="crayon-5768647c9c536524965631-11">
               11
              </div>
              <div class="crayon-num crayon-striped-num" data-line="crayon-5768647c9c536524965631-12">
               12
              </div>
              <div class="crayon-num" data-line="crayon-5768647c9c536524965631-13">
               13
              </div>
              <div class="crayon-num crayon-striped-num" data-line="crayon-5768647c9c536524965631-14">
               14
              </div>
              <div class="crayon-num" data-line="crayon-5768647c9c536524965631-15">
               15
              </div>
              <div class="crayon-num crayon-striped-num" data-line="crayon-5768647c9c536524965631-16">
               16
              </div>
              <div class="crayon-num" data-line="crayon-5768647c9c536524965631-17">
               17
              </div>
              <div class="crayon-num crayon-striped-num" data-line="crayon-5768647c9c536524965631-18">
               18
              </div>
              <div class="crayon-num" data-line="crayon-5768647c9c536524965631-19">
               19
              </div>
             </div>
            </td>
            <td class="crayon-code">
             <div class="crayon-pre" style="font-size: 12px !important; line-height: 15px !important; -moz-tab-size:4; -o-tab-size:4; -webkit-tab-size:4; tab-size:4;">
              <div class="crayon-line" id="crayon-5768647c9c536524965631-1">
               <span class="crayon-h">
               </span>
               <span class="crayon-v">
                _id
               </span>
               <span class="crayon-o">
                :
               </span>
               <span class="crayon-h">
               </span>
               <span class="crayon-e">
                POST_ID
               </span>
              </div>
              <div class="crayon-line crayon-striped-line" id="crayon-5768647c9c536524965631-2">
               <span class="crayon-e">
               </span>
               <span class="crayon-v">
                title
               </span>
               <span class="crayon-o">
                :
               </span>
               <span class="crayon-h">
               </span>
               <span class="crayon-v">
                TITLE_OF_POST
               </span>
               <span class="crayon-sy">
                ,
               </span>
               <span class="crayon-h">
               </span>
              </div>
              <div class="crayon-line" id="crayon-5768647c9c536524965631-3">
               <span class="crayon-h">
               </span>
               <span class="crayon-v">
                description
               </span>
               <span class="crayon-o">
                :
               </span>
               <span class="crayon-h">
               </span>
               <span class="crayon-v">
                POST_DESCRIPTION
               </span>
               <span class="crayon-sy">
                ,
               </span>
              </div>
              <div class="crayon-line crayon-striped-line" id="crayon-5768647c9c536524965631-4">
               <span class="crayon-h">
               </span>
               <span class="crayon-v">
                author
               </span>
               <span class="crayon-o">
                :
               </span>
               <span class="crayon-h">
               </span>
               <span class="crayon-v">
                POST_BY
               </span>
               <span class="crayon-sy">
                ,
               </span>
              </div>
              <div class="crayon-line" id="crayon-5768647c9c536524965631-5">
               <span class="crayon-h">
               </span>
               <span class="crayon-v">
                tags
               </span>
               <span class="crayon-o">
                :
               </span>
               <span class="crayon-h">
               </span>
               <span class="crayon-sy">
                [
               </span>
               <span class="crayon-v">
                TAG1
               </span>
               <span class="crayon-sy">
                ,
               </span>
               <span class="crayon-h">
               </span>
               <span class="crayon-v">
                TAG2
               </span>
               <span class="crayon-sy">
                ,
               </span>
               <span class="crayon-h">
               </span>
               <span class="crayon-v">
                TAG3
               </span>
               <span class="crayon-sy">
                ]
               </span>
               <span class="crayon-sy">
                ,
               </span>
              </div>
              <div class="crayon-line crayon-striped-line" id="crayon-5768647c9c536524965631-6">
               <span class="crayon-h">
               </span>
               <span class="crayon-v">
                likes
               </span>
               <span class="crayon-o">
                :
               </span>
               <span class="crayon-h">
               </span>
               <span class="crayon-v">
                TOTAL_LIKES
               </span>
               <span class="crayon-sy">
                ,
               </span>
               <span class="crayon-h">
               </span>
              </div>
              <div class="crayon-line" id="crayon-5768647c9c536524965631-7">
               <span class="crayon-h">
               </span>
               <span class="crayon-v">
                comments
               </span>
               <span class="crayon-o">
                :
               </span>
               <span class="crayon-h">
               </span>
               <span class="crayon-sy">
                [
               </span>
               <span class="crayon-h">
               </span>
              </div>
              <div class="crayon-line crayon-striped-line" id="crayon-5768647c9c536524965631-8">
               <span class="crayon-h">
               </span>
               <span class="crayon-sy">
                {
               </span>
              </div>
              <div class="crayon-line" id="crayon-5768647c9c536524965631-9">
               <span class="crayon-h">
               </span>
               <span class="crayon-v">
                user
               </span>
               <span class="crayon-o">
                :
               </span>
               <span class="crayon-s">
                'COMMENT_BY'
               </span>
               <span class="crayon-sy">
                ,
               </span>
              </div>
              <div class="crayon-line crayon-striped-line" id="crayon-5768647c9c536524965631-10">
               <span class="crayon-h">
               </span>
               <span class="crayon-v">
                message
               </span>
               <span class="crayon-o">
                :
               </span>
               <span class="crayon-h">
               </span>
               <span class="crayon-v">
                TEXT
               </span>
               <span class="crayon-sy">
                ,
               </span>
              </div>
              <div class="crayon-line" id="crayon-5768647c9c536524965631-11">
               <span class="crayon-h">
               </span>
               <span class="crayon-v">
                dateCreated
               </span>
               <span class="crayon-o">
                :
               </span>
               <span class="crayon-h">
               </span>
               <span class="crayon-v">
                DATE_TIME
               </span>
               <span class="crayon-sy">
                ,
               </span>
              </div>
              <div class="crayon-line crayon-striped-line" id="crayon-5768647c9c536524965631-12">
               <span class="crayon-h">
               </span>
               <span class="crayon-sy">
                }
               </span>
               <span class="crayon-sy">
                ,
               </span>
              </div>
              <div class="crayon-line" id="crayon-5768647c9c536524965631-13">
               <span class="crayon-h">
               </span>
               <span class="crayon-sy">
                {
               </span>
              </div>
              <div class="crayon-line crayon-striped-line" id="crayon-5768647c9c536524965631-14">
               <span class="crayon-h">
               </span>
               <span class="crayon-v">
                user
               </span>
               <span class="crayon-o">
                :
               </span>
               <span class="crayon-s">
                'COMMENT_BY'
               </span>
               <span class="crayon-sy">
                ,
               </span>
              </div>
              <div class="crayon-line" id="crayon-5768647c9c536524965631-15">
               <span class="crayon-h">
               </span>
               <span class="crayon-v">
                message
               </span>
               <span class="crayon-o">
                :
               </span>
               <span class="crayon-h">
               </span>
               <span class="crayon-v">
                TEXT
               </span>
               <span class="crayon-sy">
                ,
               </span>
              </div>
              <div class="crayon-line crayon-striped-line" id="crayon-5768647c9c536524965631-16">
               <span class="crayon-h">
               </span>
               <span class="crayon-v">
                dateCreated
               </span>
               <span class="crayon-o">
                :
               </span>
               <span class="crayon-h">
               </span>
               <span class="crayon-v">
                DATE_TIME
               </span>
               <span class="crayon-sy">
                ,
               </span>
              </div>
              <div class="crayon-line" id="crayon-5768647c9c536524965631-17">
               <span class="crayon-h">
               </span>
               <span class="crayon-sy">
                }
               </span>
              </div>
              <div class="crayon-line crayon-striped-line" id="crayon-5768647c9c536524965631-18">
               <span class="crayon-h">
               </span>
               <span class="crayon-sy">
                ]
               </span>
              </div>
              <div class="crayon-line" id="crayon-5768647c9c536524965631-19">
              </div>
             </div>
            </td>
           </tr>
          </tbody>
         </table>
        </div>
       </div>
       <!-- [Format Time: 0.0154 seconds] -->
       <p>
        在MongoDB里，每篇博客文章以一个文件(document)的形式保存起来，而文件内部包含了很多项目，比如
        <code>
         title tags
        </code>
        等，每一个项目都是
        <code>
         key-value
        </code>
        的形式，即有一个项目的名字，比如
        <code>
         title
        </code>
        ，以及它的值
        <code>
         TITLE_OF_POST
        </code>
        。而重要的是，一个
        <code>
         key
        </code>
        可以有多个
        <code>
         values
        </code>
        ，他们用
        <code>
         []
        </code>
        括起来。
       </p>
       <p>
        这种“宽松”的数据存储形式非常灵活，MongoDB不限制每个
        <code>
         key
        </code>
        对应的
        <code>
         values
        </code>
        的数目。比如有的文章没有评论，则它的值就是一个空集，完全没有问题；有的文章评论很多，也可以无限制地插入。更灵活的是，MongoDB不要求同一个集合(collection，相当于SQL的table)里面的不同document有相同的key，比如除了上述这种文件组织，有的文件所代表的文章可能没有likes这个项目，再比如有的文章可能有更多的项目，比如可能还有dislikes等等。这些不同的文件都可以灵活地存储在同一个集合下，而且查询起来也异常简单，因为都在一个文件里，不用进行各种跨文件查询。而这种MongoDB式的存储也方便了数据的维护，对于一篇博客文章来说，所有的相关数据都在这个document里面，不用去考虑一个数据操作需要involve多少个表格。
       </p>
       <p>
        当然，除了上述的优点，MongoDB还有不少别的优势，比如MongoDB的数据是用JSON(Javascript Object Notation)存储的(就是上面的这种key-value的形式)，而几乎所有的web应用都是基于Javascript的。因此，存储的数据和应用的数据的格式是高度一致的，不需经过转换。更多的优点可以查看：
        <a href="http://www.tutorialspoint.com/mongodb/mongodb_advantages.htm">
         [2]
        </a>
        。
       </p>
       <h4>
        <a class="anchor" href="https://github.com/StevenSLXie/Tutorials-for-Web-Developers/blob/master/MongoDB%20%E6%9E%81%E7%AE%80%E5%AE%9E%E8%B7%B5%E5%85%A5%E9%97%A8.md#2-%E5%85%B3%E4%BA%8E%E8%BF%99%E7%AF%87%E6%96%87%E7%AB%A0" id="user-content-2-关于这篇文章">
        </a>
        2. 关于这篇文章
       </h4>
       <p>
        这个极简教程，或者说笔记，并不是一个覆盖MongoDB方方面面的教程。所谓极简的意思，就是只选取那些最重要、最常用的内容进行基于实例的介绍，从而让读者能够在最短的时间内快速上手，并且能顺利地进行后续的纵深的学习。
       </p>
       <p>
        具体地说，这个教程的特点是：
       </p>
       <ul class="task-list">
        <li>
         不求全面，只求实用。只覆盖最核心的部分；
        </li>
        <li>
         以大量例子为导向；
        </li>
        <li>
         一边阅读一边动手操作的话，大约只需要2小时的时间；
        </li>
       </ul>
       <p>
        阅读这篇文章不需要有特别的基础，但最好知道数据库的基本概念，如果本身熟悉SQL那就更好啦。
       </p>
       <h4>
        <a class="anchor" href="https://github.com/StevenSLXie/Tutorials-for-Web-Developers/blob/master/MongoDB%20%E6%9E%81%E7%AE%80%E5%AE%9E%E8%B7%B5%E5%85%A5%E9%97%A8.md#3-%E5%AE%89%E8%A3%85%E4%B8%8E%E7%8E%AF%E5%A2%83" id="user-content-3-安装与环境">
        </a>
        3. 安装与环境
       </h4>
       <p>
        MongoDB可以在Windows、Linux、Mac OS X等主流平台运行，而且下载和安装非常简单，非常友好。这篇文档的例子采用MongoDB 2.6版本，均在OS X测试过，有充足的理由相信，在其它平台也能顺利运行。
       </p>
       <p>
        Windows的安装和设置可以参考：
        <a href="http://www.w3cschool.cc/mongodb/mongodb-window-install.html%EF%BC%9B">
         http://www.w3cschool.cc/mongodb/mongodb-window-install.html；
        </a>
       </p>
       <p>
        Linux的安装和设置可以参考：
        <a href="http://www.w3cschool.cc/mongodb/mongodb-linux-install.html%EF%BC%9B">
         http://www.w3cschool.cc/mongodb/mongodb-linux-install.html；
        </a>
       </p>
       <p>
        Mac OS X下的安装和设置：
       </p>
       <ul class="task-list">
        <li>
         1. 在
         <a href="https://www.mongodb.org/">
          https://www.mongodb.org/
         </a>
         下载适合你的Mac的MongoDb;
        </li>
        <li>
         2. 下载得到的文件是一个zip文件，解压，然后放到你想到的文件夹，比如/Users/Steven/MongoDB;
        </li>
        <li>
         3. 创建一个你喜欢的文件夹来存储你的数据，比如/User/Steven/myData;
        </li>
        <li>
         4. 打开Terminal，cd到2里面那个文件夹/Users/Steven/MongoDB，再cd bin;
        </li>
        <li>
         5. 输入./mongod –dbpath /User/Steven/myData,等到出现类似“waiting for connections on port 27017”，说明MongoDB服务器已架设好，而数据将储存在myData里面；
        </li>
        <li>
         6. 新打开一个Terminal, cd /Users/Steven/MongoDB/bin,然后运行./mongo;顺利的话它将出现一个interactive shell让你进行各种操作，而你的数据将储存在myData里
        </li>
       </ul>
       <p>
        如果以上的各个步骤都运行顺利，就可以跳到下一节啦。
       </p>
       <h4>
        <a class="anchor" href="https://github.com/StevenSLXie/Tutorials-for-Web-Developers/blob/master/MongoDB%20%E6%9E%81%E7%AE%80%E5%AE%9E%E8%B7%B5%E5%85%A5%E9%97%A8.md#4-%E5%88%9B%E5%BB%BA%E9%9B%86%E5%90%88%E5%92%8C%E5%88%A0%E9%99%A4%E9%9B%86%E5%90%88" id="user-content-4-创建集合和删除集合">
        </a>
        4. 创建集合和删除集合
       </h4>
       <p>
        在上一节执行完步骤6后，你会看到命令行里显示：
        <code>
         connecting to: test
        </code>
        ，这里的
        <code>
         test
        </code>
        是默认的数据库。这里我们可以新建一个数据库。在命令行里打入：
       </p>
       <!-- Crayon Syntax Highlighter v_2.7.2_beta -->
       <div class="crayon-syntax crayon-theme-classic crayon-font-monaco crayon-os-pc print-yes notranslate" data-settings=" minimize scroll-mouseover" id="crayon-5768647c9c542264971018" style=" margin-top: 12px; margin-bottom: 12px; font-size: 12px !important; line-height: 15px !important;">
        <div class="crayon-toolbar" data-settings=" mouseover overlay hide delay" style="font-size: 12px !important;height: 18px !important; line-height: 18px !important;">
         <span class="crayon-title">
         </span>
         <div class="crayon-tools" style="font-size: 12px !important;height: 18px !important; line-height: 18px !important;">
          <div class="crayon-button crayon-nums-button" title="切换是否显示行编号">
           <div class="crayon-button-icon">
           </div>
          </div>
          <div class="crayon-button crayon-plain-button" title="纯文本显示代码">
           <div class="crayon-button-icon">
           </div>
          </div>
          <div class="crayon-button crayon-wrap-button" title="切换自动换行">
           <div class="crayon-button-icon">
           </div>
          </div>
          <div class="crayon-button crayon-expand-button" title="点击展开代码">
           <div class="crayon-button-icon">
           </div>
          </div>
          <div class="crayon-button crayon-copy-button" title="复制代码">
           <div class="crayon-button-icon">
           </div>
          </div>
          <div class="crayon-button crayon-popup-button" title="在新窗口中显示代码">
           <div class="crayon-button-icon">
           </div>
          </div>
         </div>
        </div>
        <div class="crayon-info" style="min-height: 16.8px !important; line-height: 16.8px !important;">
        </div>
        <div class="crayon-plain-wrap">
         <textarea class="crayon-plain print-no" data-settings="dblclick" readonly="" style="-moz-tab-size:4; -o-tab-size:4; -webkit-tab-size:4; tab-size:4; font-size: 12px !important; line-height: 15px !important;" wrap="soft">
          use tutorial
         </textarea>
        </div>
        <div class="crayon-main" style="">
         <table class="crayon-table">
          <tbody>
           <tr class="crayon-row">
            <td class="crayon-nums " data-settings="show">
             <div class="crayon-nums-content" style="font-size: 12px !important; line-height: 15px !important;">
              <div class="crayon-num" data-line="crayon-5768647c9c542264971018-1">
               1
              </div>
              <div class="crayon-num crayon-striped-num" data-line="crayon-5768647c9c542264971018-2">
               2
              </div>
             </div>
            </td>
            <td class="crayon-code">
             <div class="crayon-pre" style="font-size: 12px !important; line-height: 15px !important; -moz-tab-size:4; -o-tab-size:4; -webkit-tab-size:4; tab-size:4;">
              <div class="crayon-line" id="crayon-5768647c9c542264971018-1">
               <span class="crayon-st">
                use
               </span>
               <span class="crayon-h">
               </span>
               <span class="crayon-i">
                tutorial
               </span>
              </div>
              <div class="crayon-line crayon-striped-line" id="crayon-5768647c9c542264971018-2">
              </div>
             </div>
            </td>
           </tr>
          </tbody>
         </table>
        </div>
       </div>
       <!-- [Format Time: 0.0099 seconds] -->
       <p>
        这样就新建了一个叫做
        <code>
         tutorial
        </code>
        的数据库。你可以执行
       </p>
       <!-- Crayon Syntax Highlighter v_2.7.2_beta -->
       <div class="crayon-syntax crayon-theme-classic crayon-font-monaco crayon-os-pc print-yes notranslate" data-settings=" minimize scroll-mouseover" id="crayon-5768647c9c548939337688" style=" margin-top: 12px; margin-bottom: 12px; font-size: 12px !important; line-height: 15px !important;">
        <div class="crayon-toolbar" data-settings=" mouseover overlay hide delay" style="font-size: 12px !important;height: 18px !important; line-height: 18px !important;">
         <span class="crayon-title">
         </span>
         <div class="crayon-tools" style="font-size: 12px !important;height: 18px !important; line-height: 18px !important;">
          <div class="crayon-button crayon-nums-button" title="切换是否显示行编号">
           <div class="crayon-button-icon">
           </div>
          </div>
          <div class="crayon-button crayon-plain-button" title="纯文本显示代码">
           <div class="crayon-button-icon">
           </div>
          </div>
          <div class="crayon-button crayon-wrap-button" title="切换自动换行">
           <div class="crayon-button-icon">
           </div>
          </div>
          <div class="crayon-button crayon-expand-button" title="点击展开代码">
           <div class="crayon-button-icon">
           </div>
          </div>
          <div class="crayon-button crayon-copy-button" title="复制代码">
           <div class="crayon-button-icon">
           </div>
          </div>
          <div class="crayon-button crayon-popup-button" title="在新窗口中显示代码">
           <div class="crayon-button-icon">
           </div>
          </div>
         </div>
        </div>
        <div class="crayon-info" style="min-height: 16.8px !important; line-height: 16.8px !important;">
        </div>
        <div class="crayon-plain-wrap">
         <textarea class="crayon-plain print-no" data-settings="dblclick" readonly="" style="-moz-tab-size:4; -o-tab-size:4; -webkit-tab-size:4; tab-size:4; font-size: 12px !important; line-height: 15px !important;" wrap="soft">
          show databases
         </textarea>
        </div>
        <div class="crayon-main" style="">
         <table class="crayon-table">
          <tbody>
           <tr class="crayon-row">
            <td class="crayon-nums " data-settings="show">
             <div class="crayon-nums-content" style="font-size: 12px !important; line-height: 15px !important;">
              <div class="crayon-num" data-line="crayon-5768647c9c548939337688-1">
               1
              </div>
              <div class="crayon-num crayon-striped-num" data-line="crayon-5768647c9c548939337688-2">
               2
              </div>
             </div>
            </td>
            <td class="crayon-code">
             <div class="crayon-pre" style="font-size: 12px !important; line-height: 15px !important; -moz-tab-size:4; -o-tab-size:4; -webkit-tab-size:4; tab-size:4;">
              <div class="crayon-line" id="crayon-5768647c9c548939337688-1">
               <span class="crayon-e">
                show
               </span>
               <span class="crayon-i">
                databases
               </span>
              </div>
              <div class="crayon-line crayon-striped-line" id="crayon-5768647c9c548939337688-2">
              </div>
             </div>
            </td>
           </tr>
          </tbody>
         </table>
        </div>
       </div>
       <!-- [Format Time: 0.0005 seconds] -->
       <p>
        来显示当前的数据库。不过这时候由于我们的新数据库是空的，所以会显示类似这样的：
       </p>
       <!-- Crayon Syntax Highlighter v_2.7.2_beta -->
       <div class="crayon-syntax crayon-theme-classic crayon-font-monaco crayon-os-pc print-yes notranslate" data-settings=" minimize scroll-mouseover" id="crayon-5768647c9c54f881522511" style=" margin-top: 12px; margin-bottom: 12px; font-size: 12px !important; line-height: 15px !important;">
        <div class="crayon-toolbar" data-settings=" mouseover overlay hide delay" style="font-size: 12px !important;height: 18px !important; line-height: 18px !important;">
         <span class="crayon-title">
         </span>
         <div class="crayon-tools" style="font-size: 12px !important;height: 18px !important; line-height: 18px !important;">
          <div class="crayon-button crayon-nums-button" title="切换是否显示行编号">
           <div class="crayon-button-icon">
           </div>
          </div>
          <div class="crayon-button crayon-plain-button" title="纯文本显示代码">
           <div class="crayon-button-icon">
           </div>
          </div>
          <div class="crayon-button crayon-wrap-button" title="切换自动换行">
           <div class="crayon-button-icon">
           </div>
          </div>
          <div class="crayon-button crayon-expand-button" title="点击展开代码">
           <div class="crayon-button-icon">
           </div>
          </div>
          <div class="crayon-button crayon-copy-button" title="复制代码">
           <div class="crayon-button-icon">
           </div>
          </div>
          <div class="crayon-button crayon-popup-button" title="在新窗口中显示代码">
           <div class="crayon-button-icon">
           </div>
          </div>
         </div>
        </div>
        <div class="crayon-info" style="min-height: 16.8px !important; line-height: 16.8px !important;">
        </div>
        <div class="crayon-plain-wrap">
         <textarea class="crayon-plain print-no" data-settings="dblclick" readonly="" style="-moz-tab-size:4; -o-tab-size:4; -webkit-tab-size:4; tab-size:4; font-size: 12px !important; line-height: 15px !important;" wrap="soft">
          admin  (empty)
local  0.078GB
         </textarea>
        </div>
        <div class="crayon-main" style="">
         <table class="crayon-table">
          <tbody>
           <tr class="crayon-row">
            <td class="crayon-nums " data-settings="show">
             <div class="crayon-nums-content" style="font-size: 12px !important; line-height: 15px !important;">
              <div class="crayon-num" data-line="crayon-5768647c9c54f881522511-1">
               1
              </div>
              <div class="crayon-num crayon-striped-num" data-line="crayon-5768647c9c54f881522511-2">
               2
              </div>
              <div class="crayon-num" data-line="crayon-5768647c9c54f881522511-3">
               3
              </div>
             </div>
            </td>
            <td class="crayon-code">
             <div class="crayon-pre" style="font-size: 12px !important; line-height: 15px !important; -moz-tab-size:4; -o-tab-size:4; -webkit-tab-size:4; tab-size:4;">
              <div class="crayon-line" id="crayon-5768647c9c54f881522511-1">
               <span class="crayon-e">
                admin
               </span>
               <span class="crayon-h">
               </span>
               <span class="crayon-sy">
                (
               </span>
               <span class="crayon-v">
                empty
               </span>
               <span class="crayon-sy">
                )
               </span>
              </div>
              <div class="crayon-line crayon-striped-line" id="crayon-5768647c9c54f881522511-2">
               <span class="crayon-i">
                local
               </span>
               <span class="crayon-h">
               </span>
               <span class="crayon-cn">
                0.078GB
               </span>
              </div>
              <div class="crayon-line" id="crayon-5768647c9c54f881522511-3">
              </div>
             </div>
            </td>
           </tr>
          </tbody>
         </table>
        </div>
       </div>
       <!-- [Format Time: 0.0007 seconds] -->
       <p>
        我们试着往我们的数据库里添加一个集合(collection)，MongoDB里的集合和SQL里面的表格是类似的：
       </p>
       <!-- Crayon Syntax Highlighter v_2.7.2_beta -->
       <div class="crayon-syntax crayon-theme-classic crayon-font-monaco crayon-os-pc print-yes notranslate" data-settings=" minimize scroll-mouseover" id="crayon-5768647c9c554000449283" style=" margin-top: 12px; margin-bottom: 12px; font-size: 12px !important; line-height: 15px !important;">
        <div class="crayon-toolbar" data-settings=" mouseover overlay hide delay" style="font-size: 12px !important;height: 18px !important; line-height: 18px !important;">
         <span class="crayon-title">
         </span>
         <div class="crayon-tools" style="font-size: 12px !important;height: 18px !important; line-height: 18px !important;">
          <div class="crayon-button crayon-nums-button" title="切换是否显示行编号">
           <div class="crayon-button-icon">
           </div>
          </div>
          <div class="crayon-button crayon-plain-button" title="纯文本显示代码">
           <div class="crayon-button-icon">
           </div>
          </div>
          <div class="crayon-button crayon-wrap-button" title="切换自动换行">
           <div class="crayon-button-icon">
           </div>
          </div>
          <div class="crayon-button crayon-expand-button" title="点击展开代码">
           <div class="crayon-button-icon">
           </div>
          </div>
          <div class="crayon-button crayon-copy-button" title="复制代码">
           <div class="crayon-button-icon">
           </div>
          </div>
          <div class="crayon-button crayon-popup-button" title="在新窗口中显示代码">
           <div class="crayon-button-icon">
           </div>
          </div>
         </div>
        </div>
        <div class="crayon-info" style="min-height: 16.8px !important; line-height: 16.8px !important;">
        </div>
        <div class="crayon-plain-wrap">
         <textarea class="crayon-plain print-no" data-settings="dblclick" readonly="" style="-moz-tab-size:4; -o-tab-size:4; -webkit-tab-size:4; tab-size:4; font-size: 12px !important; line-height: 15px !important;" wrap="soft">
          db.createCollection('author')
         </textarea>
        </div>
        <div class="crayon-main" style="">
         <table class="crayon-table">
          <tbody>
           <tr class="crayon-row">
            <td class="crayon-nums " data-settings="show">
             <div class="crayon-nums-content" style="font-size: 12px !important; line-height: 15px !important;">
              <div class="crayon-num" data-line="crayon-5768647c9c554000449283-1">
               1
              </div>
              <div class="crayon-num crayon-striped-num" data-line="crayon-5768647c9c554000449283-2">
               2
              </div>
             </div>
            </td>
            <td class="crayon-code">
             <div class="crayon-pre" style="font-size: 12px !important; line-height: 15px !important; -moz-tab-size:4; -o-tab-size:4; -webkit-tab-size:4; tab-size:4;">
              <div class="crayon-line" id="crayon-5768647c9c554000449283-1">
               <span class="crayon-v">
                db
               </span>
               <span class="crayon-sy">
                .
               </span>
               <span class="crayon-e">
                createCollection
               </span>
               <span class="crayon-sy">
                (
               </span>
               <span class="crayon-s">
                'author'
               </span>
               <span class="crayon-sy">
                )
               </span>
              </div>
              <div class="crayon-line crayon-striped-line" id="crayon-5768647c9c554000449283-2">
              </div>
             </div>
            </td>
           </tr>
          </tbody>
         </table>
        </div>
       </div>
       <!-- [Format Time: 0.0006 seconds] -->
       <p>
        顺利的话会显示：
       </p>
       <!-- Crayon Syntax Highlighter v_2.7.2_beta -->
       <div class="crayon-syntax crayon-theme-classic crayon-font-monaco crayon-os-pc print-yes notranslate" data-settings=" minimize scroll-mouseover" id="crayon-5768647c9c55a961007242" style=" margin-top: 12px; margin-bottom: 12px; font-size: 12px !important; line-height: 15px !important;">
        <div class="crayon-toolbar" data-settings=" mouseover overlay hide delay" style="font-size: 12px !important;height: 18px !important; line-height: 18px !important;">
         <span class="crayon-title">
         </span>
         <div class="crayon-tools" style="font-size: 12px !important;height: 18px !important; line-height: 18px !important;">
          <div class="crayon-button crayon-nums-button" title="切换是否显示行编号">
           <div class="crayon-button-icon">
           </div>
          </div>
          <div class="crayon-button crayon-plain-button" title="纯文本显示代码">
           <div class="crayon-button-icon">
           </div>
          </div>
          <div class="crayon-button crayon-wrap-button" title="切换自动换行">
           <div class="crayon-button-icon">
           </div>
          </div>
          <div class="crayon-button crayon-expand-button" title="点击展开代码">
           <div class="crayon-button-icon">
           </div>
          </div>
          <div class="crayon-button crayon-copy-button" title="复制代码">
           <div class="crayon-button-icon">
           </div>
          </div>
          <div class="crayon-button crayon-popup-button" title="在新窗口中显示代码">
           <div class="crayon-button-icon">
           </div>
          </div>
         </div>
        </div>
        <div class="crayon-info" style="min-height: 16.8px !important; line-height: 16.8px !important;">
        </div>
        <div class="crayon-plain-wrap">
         <textarea class="crayon-plain print-no" data-settings="dblclick" readonly="" style="-moz-tab-size:4; -o-tab-size:4; -webkit-tab-size:4; tab-size:4; font-size: 12px !important; line-height: 15px !important;" wrap="soft">
          { "ok" : 1 }
         </textarea>
        </div>
        <div class="crayon-main" style="">
         <table class="crayon-table">
          <tbody>
           <tr class="crayon-row">
            <td class="crayon-nums " data-settings="show">
             <div class="crayon-nums-content" style="font-size: 12px !important; line-height: 15px !important;">
              <div class="crayon-num" data-line="crayon-5768647c9c55a961007242-1">
               1
              </div>
              <div class="crayon-num crayon-striped-num" data-line="crayon-5768647c9c55a961007242-2">
               2
              </div>
             </div>
            </td>
            <td class="crayon-code">
             <div class="crayon-pre" style="font-size: 12px !important; line-height: 15px !important; -moz-tab-size:4; -o-tab-size:4; -webkit-tab-size:4; tab-size:4;">
              <div class="crayon-line" id="crayon-5768647c9c55a961007242-1">
               <span class="crayon-sy">
                {
               </span>
               <span class="crayon-h">
               </span>
               <span class="crayon-s">
                "ok"
               </span>
               <span class="crayon-h">
               </span>
               <span class="crayon-o">
                :
               </span>
               <span class="crayon-h">
               </span>
               <span class="crayon-cn">
                1
               </span>
               <span class="crayon-h">
               </span>
               <span class="crayon-sy">
                }
               </span>
              </div>
              <div class="crayon-line crayon-striped-line" id="crayon-5768647c9c55a961007242-2">
              </div>
             </div>
            </td>
           </tr>
          </tbody>
         </table>
        </div>
       </div>
       <!-- [Format Time: 0.0008 seconds] -->
       <p>
        表示创建成功。
       </p>
       <p>
        你可以再回头执行：
       </p>
       <!-- Crayon Syntax Highlighter v_2.7.2_beta -->
       <div class="crayon-syntax crayon-theme-classic crayon-font-monaco crayon-os-pc print-yes notranslate" data-settings=" minimize scroll-mouseover" id="crayon-5768647c9c55f715558828" style=" margin-top: 12px; margin-bottom: 12px; font-size: 12px !important; line-height: 15px !important;">
        <div class="crayon-toolbar" data-settings=" mouseover overlay hide delay" style="font-size: 12px !important;height: 18px !important; line-height: 18px !important;">
         <span class="crayon-title">
         </span>
         <div class="crayon-tools" style="font-size: 12px !important;height: 18px !important; line-height: 18px !important;">
          <div class="crayon-button crayon-nums-button" title="切换是否显示行编号">
           <div class="crayon-button-icon">
           </div>
          </div>
          <div class="crayon-button crayon-plain-button" title="纯文本显示代码">
           <div class="crayon-button-icon">
           </div>
          </div>
          <div class="crayon-button crayon-wrap-button" title="切换自动换行">
           <div class="crayon-button-icon">
           </div>
          </div>
          <div class="crayon-button crayon-expand-button" title="点击展开代码">
           <div class="crayon-button-icon">
           </div>
          </div>
          <div class="crayon-button crayon-copy-button" title="复制代码">
           <div class="crayon-button-icon">
           </div>
          </div>
          <div class="crayon-button crayon-popup-button" title="在新窗口中显示代码">
           <div class="crayon-button-icon">
           </div>
          </div>
         </div>
        </div>
        <div class="crayon-info" style="min-height: 16.8px !important; line-height: 16.8px !important;">
        </div>
        <div class="crayon-plain-wrap">
         <textarea class="crayon-plain print-no" data-settings="dblclick" readonly="" style="-moz-tab-size:4; -o-tab-size:4; -webkit-tab-size:4; tab-size:4; font-size: 12px !important; line-height: 15px !important;" wrap="soft">
          show databases
         </textarea>
        </div>
        <div class="crayon-main" style="">
         <table class="crayon-table">
          <tbody>
           <tr class="crayon-row">
            <td class="crayon-nums " data-settings="show">
             <div class="crayon-nums-content" style="font-size: 12px !important; line-height: 15px !important;">
              <div class="crayon-num" data-line="crayon-5768647c9c55f715558828-1">
               1
              </div>
              <div class="crayon-num crayon-striped-num" data-line="crayon-5768647c9c55f715558828-2">
               2
              </div>
             </div>
            </td>
            <td class="crayon-code">
             <div class="crayon-pre" style="font-size: 12px !important; line-height: 15px !important; -moz-tab-size:4; -o-tab-size:4; -webkit-tab-size:4; tab-size:4;">
              <div class="crayon-line" id="crayon-5768647c9c55f715558828-1">
               <span class="crayon-e">
                show
               </span>
               <span class="crayon-i">
                databases
               </span>
              </div>
              <div class="crayon-line crayon-striped-line" id="crayon-5768647c9c55f715558828-2">
              </div>
             </div>
            </td>
           </tr>
          </tbody>
         </table>
        </div>
       </div>
       <!-- [Format Time: 0.0066 seconds] -->
       <p>
        这时候我们的tutorial集合已经位列其中。你可以再执行
       </p>
       <!-- Crayon Syntax Highlighter v_2.7.2_beta -->
       <div class="crayon-syntax crayon-theme-classic crayon-font-monaco crayon-os-pc print-yes notranslate" data-settings=" minimize scroll-mouseover" id="crayon-5768647c9c565844446726" style=" margin-top: 12px; margin-bottom: 12px; font-size: 12px !important; line-height: 15px !important;">
        <div class="crayon-toolbar" data-settings=" mouseover overlay hide delay" style="font-size: 12px !important;height: 18px !important; line-height: 18px !important;">
         <span class="crayon-title">
         </span>
         <div class="crayon-tools" style="font-size: 12px !important;height: 18px !important; line-height: 18px !important;">
          <div class="crayon-button crayon-nums-button" title="切换是否显示行编号">
           <div class="crayon-button-icon">
           </div>
          </div>
          <div class="crayon-button crayon-plain-button" title="纯文本显示代码">
           <div class="crayon-button-icon">
           </div>
          </div>
          <div class="crayon-button crayon-wrap-button" title="切换自动换行">
           <div class="crayon-button-icon">
           </div>
          </div>
          <div class="crayon-button crayon-expand-button" title="点击展开代码">
           <div class="crayon-button-icon">
           </div>
          </div>
          <div class="crayon-button crayon-copy-button" title="复制代码">
           <div class="crayon-button-icon">
           </div>
          </div>
          <div class="crayon-button crayon-popup-button" title="在新窗口中显示代码">
           <div class="crayon-button-icon">
           </div>
          </div>
         </div>
        </div>
        <div class="crayon-info" style="min-height: 16.8px !important; line-height: 16.8px !important;">
        </div>
        <div class="crayon-plain-wrap">
         <textarea class="crayon-plain print-no" data-settings="dblclick" readonly="" style="-moz-tab-size:4; -o-tab-size:4; -webkit-tab-size:4; tab-size:4; font-size: 12px !important; line-height: 15px !important;" wrap="soft">
          show collections
         </textarea>
        </div>
        <div class="crayon-main" style="">
         <table class="crayon-table">
          <tbody>
           <tr class="crayon-row">
            <td class="crayon-nums " data-settings="show">
             <div class="crayon-nums-content" style="font-size: 12px !important; line-height: 15px !important;">
              <div class="crayon-num" data-line="crayon-5768647c9c565844446726-1">
               1
              </div>
              <div class="crayon-num crayon-striped-num" data-line="crayon-5768647c9c565844446726-2">
               2
              </div>
             </div>
            </td>
            <td class="crayon-code">
             <div class="crayon-pre" style="font-size: 12px !important; line-height: 15px !important; -moz-tab-size:4; -o-tab-size:4; -webkit-tab-size:4; tab-size:4;">
              <div class="crayon-line" id="crayon-5768647c9c565844446726-1">
               <span class="crayon-e">
                show
               </span>
               <span class="crayon-i">
                collections
               </span>
              </div>
              <div class="crayon-line crayon-striped-line" id="crayon-5768647c9c565844446726-2">
              </div>
             </div>
            </td>
           </tr>
          </tbody>
         </table>
        </div>
       </div>
       <!-- [Format Time: 0.0005 seconds] -->
       <p>
        可以看到创建的集合author也在其中。
       </p>
       <p>
        我们暂时不需要author这个集合，所以我们可以通过执行：
       </p>
       <!-- Crayon Syntax Highlighter v_2.7.2_beta -->
       <div class="crayon-syntax crayon-theme-classic crayon-font-monaco crayon-os-pc print-yes notranslate" data-settings=" minimize scroll-mouseover" id="crayon-5768647c9c56b459188406" style=" margin-top: 12px; margin-bottom: 12px; font-size: 12px !important; line-height: 15px !important;">
        <div class="crayon-toolbar" data-settings=" mouseover overlay hide delay" style="font-size: 12px !important;height: 18px !important; line-height: 18px !important;">
         <span class="crayon-title">
         </span>
         <div class="crayon-tools" style="font-size: 12px !important;height: 18px !important; line-height: 18px !important;">
          <div class="crayon-button crayon-nums-button" title="切换是否显示行编号">
           <div class="crayon-button-icon">
           </div>
          </div>
          <div class="crayon-button crayon-plain-button" title="纯文本显示代码">
           <div class="crayon-button-icon">
           </div>
          </div>
          <div class="crayon-button crayon-wrap-button" title="切换自动换行">
           <div class="crayon-button-icon">
           </div>
          </div>
          <div class="crayon-button crayon-expand-button" title="点击展开代码">
           <div class="crayon-button-icon">
           </div>
          </div>
          <div class="crayon-button crayon-copy-button" title="复制代码">
           <div class="crayon-button-icon">
           </div>
          </div>
          <div class="crayon-button crayon-popup-button" title="在新窗口中显示代码">
           <div class="crayon-button-icon">
           </div>
          </div>
         </div>
        </div>
        <div class="crayon-info" style="min-height: 16.8px !important; line-height: 16.8px !important;">
        </div>
        <div class="crayon-plain-wrap">
         <textarea class="crayon-plain print-no" data-settings="dblclick" readonly="" style="-moz-tab-size:4; -o-tab-size:4; -webkit-tab-size:4; tab-size:4; font-size: 12px !important; line-height: 15px !important;" wrap="soft">
          db.author.drop()
         </textarea>
        </div>
        <div class="crayon-main" style="">
         <table class="crayon-table">
          <tbody>
           <tr class="crayon-row">
            <td class="crayon-nums " data-settings="show">
             <div class="crayon-nums-content" style="font-size: 12px !important; line-height: 15px !important;">
              <div class="crayon-num" data-line="crayon-5768647c9c56b459188406-1">
               1
              </div>
              <div class="crayon-num crayon-striped-num" data-line="crayon-5768647c9c56b459188406-2">
               2
              </div>
             </div>
            </td>
            <td class="crayon-code">
             <div class="crayon-pre" style="font-size: 12px !important; line-height: 15px !important; -moz-tab-size:4; -o-tab-size:4; -webkit-tab-size:4; tab-size:4;">
              <div class="crayon-line" id="crayon-5768647c9c56b459188406-1">
               <span class="crayon-v">
                db
               </span>
               <span class="crayon-sy">
                .
               </span>
               <span class="crayon-v">
                author
               </span>
               <span class="crayon-sy">
                .
               </span>
               <span class="crayon-e">
                drop
               </span>
               <span class="crayon-sy">
                (
               </span>
               <span class="crayon-sy">
                )
               </span>
              </div>
              <div class="crayon-line crayon-striped-line" id="crayon-5768647c9c56b459188406-2">
              </div>
             </div>
            </td>
           </tr>
          </tbody>
         </table>
        </div>
       </div>
       <!-- [Format Time: 0.0007 seconds] -->
       <p>
        来将其删除。这时候你再执行
        <code>
         show collections
        </code>
        ，就再也看不到我们的author了。
       </p>
       <p>
        这一节要记住的点主要只有一个：集合(collection)类似于SQL的表格(table)，类似于Excel的一个个表格。
       </p>
       <h4>
        <a class="anchor" href="https://github.com/StevenSLXie/Tutorials-for-Web-Developers/blob/master/MongoDB%20%E6%9E%81%E7%AE%80%E5%AE%9E%E8%B7%B5%E5%85%A5%E9%97%A8.md#5-%E6%8F%92%E5%85%A5" id="user-content-5-插入">
        </a>
        5. 插入
       </h4>
       <p>
        想象一个精简版的“豆瓣电影”。我们需要创建一个数据库，来存储每部电影的信息，电影的信息包括：
       </p>
       <ul class="task-list">
        <li>
         电影名字
        </li>
        <li>
         导演
        </li>
        <li>
         主演(可能多个)
        </li>
        <li>
         类型标签(可能多个)
        </li>
        <li>
         上映日期
        </li>
        <li>
         喜欢人数
        </li>
        <li>
         不喜欢人数
        </li>
        <li>
         用户评论(可能多个)
        </li>
       </ul>
       <p>
        显然我们需要先创建一个叫电影的集合：
       </p>
       <!-- Crayon Syntax Highlighter v_2.7.2_beta -->
       <div class="crayon-syntax crayon-theme-classic crayon-font-monaco crayon-os-pc print-yes notranslate" data-settings=" minimize scroll-mouseover" id="crayon-5768647c9c571972290326" style=" margin-top: 12px; margin-bottom: 12px; font-size: 12px !important; line-height: 15px !important;">
        <div class="crayon-toolbar" data-settings=" mouseover overlay hide delay" style="font-size: 12px !important;height: 18px !important; line-height: 18px !important;">
         <span class="crayon-title">
         </span>
         <div class="crayon-tools" style="font-size: 12px !important;height: 18px !important; line-height: 18px !important;">
          <div class="crayon-button crayon-nums-button" title="切换是否显示行编号">
           <div class="crayon-button-icon">
           </div>
          </div>
          <div class="crayon-button crayon-plain-button" title="纯文本显示代码">
           <div class="crayon-button-icon">
           </div>
          </div>
          <div class="crayon-button crayon-wrap-button" title="切换自动换行">
           <div class="crayon-button-icon">
           </div>
          </div>
          <div class="crayon-button crayon-expand-button" title="点击展开代码">
           <div class="crayon-button-icon">
           </div>
          </div>
          <div class="crayon-button crayon-copy-button" title="复制代码">
           <div class="crayon-button-icon">
           </div>
          </div>
          <div class="crayon-button crayon-popup-button" title="在新窗口中显示代码">
           <div class="crayon-button-icon">
           </div>
          </div>
         </div>
        </div>
        <div class="crayon-info" style="min-height: 16.8px !important; line-height: 16.8px !important;">
        </div>
        <div class="crayon-plain-wrap">
         <textarea class="crayon-plain print-no" data-settings="dblclick" readonly="" style="-moz-tab-size:4; -o-tab-size:4; -webkit-tab-size:4; tab-size:4; font-size: 12px !important; line-height: 15px !important;" wrap="soft">
          db.createCollection('movie')
         </textarea>
        </div>
        <div class="crayon-main" style="">
         <table class="crayon-table">
          <tbody>
           <tr class="crayon-row">
            <td class="crayon-nums " data-settings="show">
             <div class="crayon-nums-content" style="font-size: 12px !important; line-height: 15px !important;">
              <div class="crayon-num" data-line="crayon-5768647c9c571972290326-1">
               1
              </div>
              <div class="crayon-num crayon-striped-num" data-line="crayon-5768647c9c571972290326-2">
               2
              </div>
             </div>
            </td>
            <td class="crayon-code">
             <div class="crayon-pre" style="font-size: 12px !important; line-height: 15px !important; -moz-tab-size:4; -o-tab-size:4; -webkit-tab-size:4; tab-size:4;">
              <div class="crayon-line" id="crayon-5768647c9c571972290326-1">
               <span class="crayon-v">
                db
               </span>
               <span class="crayon-sy">
                .
               </span>
               <span class="crayon-e">
                createCollection
               </span>
               <span class="crayon-sy">
                (
               </span>
               <span class="crayon-s">
                'movie'
               </span>
               <span class="crayon-sy">
                )
               </span>
              </div>
              <div class="crayon-line crayon-striped-line" id="crayon-5768647c9c571972290326-2">
              </div>
             </div>
            </td>
           </tr>
          </tbody>
         </table>
        </div>
       </div>
       <!-- [Format Time: 0.0008 seconds] -->
       <p>
        然后，我们就可以插入数据了：
       </p>
       <!-- Crayon Syntax Highlighter v_2.7.2_beta -->
       <div class="crayon-syntax crayon-theme-classic crayon-font-monaco crayon-os-pc print-yes notranslate" data-settings=" minimize scroll-mouseover" id="crayon-5768647c9c577321603090" style=" margin-top: 12px; margin-bottom: 12px; font-size: 12px !important; line-height: 15px !important;">
        <div class="crayon-toolbar" data-settings=" mouseover overlay hide delay" style="font-size: 12px !important;height: 18px !important; line-height: 18px !important;">
         <span class="crayon-title">
         </span>
         <div class="crayon-tools" style="font-size: 12px !important;height: 18px !important; line-height: 18px !important;">
          <div class="crayon-button crayon-nums-button" title="切换是否显示行编号">
           <div class="crayon-button-icon">
           </div>
          </div>
          <div class="crayon-button crayon-plain-button" title="纯文本显示代码">
           <div class="crayon-button-icon">
           </div>
          </div>
          <div class="crayon-button crayon-wrap-button" title="切换自动换行">
           <div class="crayon-button-icon">
           </div>
          </div>
          <div class="crayon-button crayon-expand-button" title="点击展开代码">
           <div class="crayon-button-icon">
           </div>
          </div>
          <div class="crayon-button crayon-copy-button" title="复制代码">
           <div class="crayon-button-icon">
           </div>
          </div>
          <div class="crayon-button crayon-popup-button" title="在新窗口中显示代码">
           <div class="crayon-button-icon">
           </div>
          </div>
         </div>
        </div>
        <div class="crayon-info" style="min-height: 16.8px !important; line-height: 16.8px !important;">
        </div>
        <div class="crayon-plain-wrap">
         <textarea class="crayon-plain print-no" data-settings="dblclick" readonly="" style="-moz-tab-size:4; -o-tab-size:4; -webkit-tab-size:4; tab-size:4; font-size: 12px !important; line-height: 15px !important;" wrap="soft">
          db.movie.insert(
 {
   title: 'Forrest Gump', 
   directed_by: 'Robert Zemeckis',
   stars: ['Tom Hanks', 'Robin Wright', 'Gary Sinise'],
   tags: ['drama', 'romance'],
   debut: new Date(1994,7,6,0,0),
   likes: 864367,
   dislikes: 30127,
   comments: [  
      {
         user:'user1',
         message: 'My first comment',
         dateCreated: new Date(2013,11,10,2,35),
         like: 0 
      },
      {
         user:'user2',
         message: 'My first comment too!',
         dateCreated: new Date(2013,11,11,6,20),
         like: 0 
      }
   ]
}
)
         </textarea>
        </div>
        <div class="crayon-main" style="">
         <table class="crayon-table">
          <tbody>
           <tr class="crayon-row">
            <td class="crayon-nums " data-settings="show">
             <div class="crayon-nums-content" style="font-size: 12px !important; line-height: 15px !important;">
              <div class="crayon-num" data-line="crayon-5768647c9c577321603090-1">
               1
              </div>
              <div class="crayon-num crayon-striped-num" data-line="crayon-5768647c9c577321603090-2">
               2
              </div>
              <div class="crayon-num" data-line="crayon-5768647c9c577321603090-3">
               3
              </div>
              <div class="crayon-num crayon-striped-num" data-line="crayon-5768647c9c577321603090-4">
               4
              </div>
              <div class="crayon-num" data-line="crayon-5768647c9c577321603090-5">
               5
              </div>
              <div class="crayon-num crayon-striped-num" data-line="crayon-5768647c9c577321603090-6">
               6
              </div>
              <div class="crayon-num" data-line="crayon-5768647c9c577321603090-7">
               7
              </div>
              <div class="crayon-num crayon-striped-num" data-line="crayon-5768647c9c577321603090-8">
               8
              </div>
              <div class="crayon-num" data-line="crayon-5768647c9c577321603090-9">
               9
              </div>
              <div class="crayon-num crayon-striped-num" data-line="crayon-5768647c9c577321603090-10">
               10
              </div>
              <div class="crayon-num" data-line="crayon-5768647c9c577321603090-11">
               11
              </div>
              <div class="crayon-num crayon-striped-num" data-line="crayon-5768647c9c577321603090-12">
               12
              </div>
              <div class="crayon-num" data-line="crayon-5768647c9c577321603090-13">
               13
              </div>
              <div class="crayon-num crayon-striped-num" data-line="crayon-5768647c9c577321603090-14">
               14
              </div>
              <div class="crayon-num" data-line="crayon-5768647c9c577321603090-15">
               15
              </div>
              <div class="crayon-num crayon-striped-num" data-line="crayon-5768647c9c577321603090-16">
               16
              </div>
              <div class="crayon-num" data-line="crayon-5768647c9c577321603090-17">
               17
              </div>
              <div class="crayon-num crayon-striped-num" data-line="crayon-5768647c9c577321603090-18">
               18
              </div>
              <div class="crayon-num" data-line="crayon-5768647c9c577321603090-19">
               19
              </div>
              <div class="crayon-num crayon-striped-num" data-line="crayon-5768647c9c577321603090-20">
               20
              </div>
              <div class="crayon-num" data-line="crayon-5768647c9c577321603090-21">
               21
              </div>
              <div class="crayon-num crayon-striped-num" data-line="crayon-5768647c9c577321603090-22">
               22
              </div>
              <div class="crayon-num" data-line="crayon-5768647c9c577321603090-23">
               23
              </div>
              <div class="crayon-num crayon-striped-num" data-line="crayon-5768647c9c577321603090-24">
               24
              </div>
              <div class="crayon-num" data-line="crayon-5768647c9c577321603090-25">
               25
              </div>
              <div class="crayon-num crayon-striped-num" data-line="crayon-5768647c9c577321603090-26">
               26
              </div>
             </div>
            </td>
            <td class="crayon-code">
             <div class="crayon-pre" style="font-size: 12px !important; line-height: 15px !important; -moz-tab-size:4; -o-tab-size:4; -webkit-tab-size:4; tab-size:4;">
              <div class="crayon-line" id="crayon-5768647c9c577321603090-1">
               <span class="crayon-v">
                db
               </span>
               <span class="crayon-sy">
                .
               </span>
               <span class="crayon-v">
                movie
               </span>
               <span class="crayon-sy">
                .
               </span>
               <span class="crayon-e">
                insert
               </span>
               <span class="crayon-sy">
                (
               </span>
              </div>
              <div class="crayon-line crayon-striped-line" id="crayon-5768647c9c577321603090-2">
               <span class="crayon-h">
               </span>
               <span class="crayon-sy">
                {
               </span>
              </div>
              <div class="crayon-line" id="crayon-5768647c9c577321603090-3">
               <span class="crayon-h">
               </span>
               <span class="crayon-v">
                title
               </span>
               <span class="crayon-o">
                :
               </span>
               <span class="crayon-h">
               </span>
               <span class="crayon-s">
                'Forrest Gump'
               </span>
               <span class="crayon-sy">
                ,
               </span>
               <span class="crayon-h">
               </span>
              </div>
              <div class="crayon-line crayon-striped-line" id="crayon-5768647c9c577321603090-4">
               <span class="crayon-h">
               </span>
               <span class="crayon-v">
                directed_by
               </span>
               <span class="crayon-o">
                :
               </span>
               <span class="crayon-h">
               </span>
               <span class="crayon-s">
                'Robert Zemeckis'
               </span>
               <span class="crayon-sy">
                ,
               </span>
              </div>
              <div class="crayon-line" id="crayon-5768647c9c577321603090-5">
               <span class="crayon-h">
               </span>
               <span class="crayon-v">
                stars
               </span>
               <span class="crayon-o">
                :
               </span>
               <span class="crayon-h">
               </span>
               <span class="crayon-sy">
                [
               </span>
               <span class="crayon-s">
                'Tom Hanks'
               </span>
               <span class="crayon-sy">
                ,
               </span>
               <span class="crayon-h">
               </span>
               <span class="crayon-s">
                'Robin Wright'
               </span>
               <span class="crayon-sy">
                ,
               </span>
               <span class="crayon-h">
               </span>
               <span class="crayon-s">
                'Gary Sinise'
               </span>
               <span class="crayon-sy">
                ]
               </span>
               <span class="crayon-sy">
                ,
               </span>
              </div>
              <div class="crayon-line crayon-striped-line" id="crayon-5768647c9c577321603090-6">
               <span class="crayon-h">
               </span>
               <span class="crayon-v">
                tags
               </span>
               <span class="crayon-o">
                :
               </span>
               <span class="crayon-h">
               </span>
               <span class="crayon-sy">
                [
               </span>
               <span class="crayon-s">
                'drama'
               </span>
               <span class="crayon-sy">
                ,
               </span>
               <span class="crayon-h">
               </span>
               <span class="crayon-s">
                'romance'
               </span>
               <span class="crayon-sy">
                ]
               </span>
               <span class="crayon-sy">
                ,
               </span>
              </div>
              <div class="crayon-line" id="crayon-5768647c9c577321603090-7">
               <span class="crayon-h">
               </span>
               <span class="crayon-v">
                debut
               </span>
               <span class="crayon-o">
                :
               </span>
               <span class="crayon-h">
               </span>
               <span class="crayon-r">
                new
               </span>
               <span class="crayon-h">
               </span>
               <span class="crayon-e">
                Date
               </span>
               <span class="crayon-sy">
                (
               </span>
               <span class="crayon-cn">
                1994
               </span>
               <span class="crayon-sy">
                ,
               </span>
               <span class="crayon-cn">
                7
               </span>
               <span class="crayon-sy">
                ,
               </span>
               <span class="crayon-cn">
                6
               </span>
               <span class="crayon-sy">
                ,
               </span>
               <span class="crayon-cn">
                0
               </span>
               <span class="crayon-sy">
                ,
               </span>
               <span class="crayon-cn">
                0
               </span>
               <span class="crayon-sy">
                )
               </span>
               <span class="crayon-sy">
                ,
               </span>
              </div>
              <div class="crayon-line crayon-striped-line" id="crayon-5768647c9c577321603090-8">
               <span class="crayon-h">
               </span>
               <span class="crayon-v">
                likes
               </span>
               <span class="crayon-o">
                :
               </span>
               <span class="crayon-h">
               </span>
               <span class="crayon-cn">
                864367
               </span>
               <span class="crayon-sy">
                ,
               </span>
              </div>
              <div class="crayon-line" id="crayon-5768647c9c577321603090-9">
               <span class="crayon-h">
               </span>
               <span class="crayon-v">
                dislikes
               </span>
               <span class="crayon-o">
                :
               </span>
               <span class="crayon-h">
               </span>
               <span class="crayon-cn">
                30127
               </span>
               <span class="crayon-sy">
                ,
               </span>
              </div>
              <div class="crayon-line crayon-striped-line" id="crayon-5768647c9c577321603090-10">
               <span class="crayon-h">
               </span>
               <span class="crayon-v">
                comments
               </span>
               <span class="crayon-o">
                :
               </span>
               <span class="crayon-h">
               </span>
               <span class="crayon-sy">
                [
               </span>
               <span class="crayon-h">
               </span>
              </div>
              <div class="crayon-line" id="crayon-5768647c9c577321603090-11">
               <span class="crayon-h">
               </span>
               <span class="crayon-sy">
                {
               </span>
              </div>
              <div class="crayon-line crayon-striped-line" id="crayon-5768647c9c577321603090-12">
               <span class="crayon-h">
               </span>
               <span class="crayon-v">
                user
               </span>
               <span class="crayon-o">
                :
               </span>
               <span class="crayon-s">
                'user1'
               </span>
               <span class="crayon-sy">
                ,
               </span>
              </div>
              <div class="crayon-line" id="crayon-5768647c9c577321603090-13">
               <span class="crayon-h">
               </span>
               <span class="crayon-v">
                message
               </span>
               <span class="crayon-o">
                :
               </span>
               <span class="crayon-h">
               </span>
               <span class="crayon-s">
                'My first comment'
               </span>
               <span class="crayon-sy">
                ,
               </span>
              </div>
              <div class="crayon-line crayon-striped-line" id="crayon-5768647c9c577321603090-14">
               <span class="crayon-h">
               </span>
               <span class="crayon-v">
                dateCreated
               </span>
               <span class="crayon-o">
                :
               </span>
               <span class="crayon-h">
               </span>
               <span class="crayon-r">
                new
               </span>
               <span class="crayon-h">
               </span>
               <span class="crayon-e">
                Date
               </span>
               <span class="crayon-sy">
                (
               </span>
               <span class="crayon-cn">
                2013
               </span>
               <span class="crayon-sy">
                ,
               </span>
               <span class="crayon-cn">
                11
               </span>
               <span class="crayon-sy">
                ,
               </span>
               <span class="crayon-cn">
                10
               </span>
               <span class="crayon-sy">
                ,
               </span>
               <span class="crayon-cn">
                2
               </span>
               <span class="crayon-sy">
                ,
               </span>
               <span class="crayon-cn">
                35
               </span>
               <span class="crayon-sy">
                )
               </span>
               <span class="crayon-sy">
                ,
               </span>
              </div>
              <div class="crayon-line" id="crayon-5768647c9c577321603090-15">
               <span class="crayon-h">
               </span>
               <span class="crayon-v">
                like
               </span>
               <span class="crayon-o">
                :
               </span>
               <span class="crayon-h">
               </span>
               <span class="crayon-cn">
                0
               </span>
               <span class="crayon-h">
               </span>
              </div>
              <div class="crayon-line crayon-striped-line" id="crayon-5768647c9c577321603090-16">
               <span class="crayon-h">
               </span>
               <span class="crayon-sy">
                }
               </span>
               <span class="crayon-sy">
                ,
               </span>
              </div>
              <div class="crayon-line" id="crayon-5768647c9c577321603090-17">
               <span class="crayon-h">
               </span>
               <span class="crayon-sy">
                {
               </span>
              </div>
              <div class="crayon-line crayon-striped-line" id="crayon-5768647c9c577321603090-18">
               <span class="crayon-h">
               </span>
               <span class="crayon-v">
                user
               </span>
               <span class="crayon-o">
                :
               </span>
               <span class="crayon-s">
                'user2'
               </span>
               <span class="crayon-sy">
                ,
               </span>
              </div>
              <div class="crayon-line" id="crayon-5768647c9c577321603090-19">
               <span class="crayon-h">
               </span>
               <span class="crayon-v">
                message
               </span>
               <span class="crayon-o">
                :
               </span>
               <span class="crayon-h">
               </span>
               <span class="crayon-s">
                'My first comment too!'
               </span>
               <span class="crayon-sy">
                ,
               </span>
              </div>
              <div class="crayon-line crayon-striped-line" id="crayon-5768647c9c577321603090-20">
               <span class="crayon-h">
               </span>
               <span class="crayon-v">
                dateCreated
               </span>
               <span class="crayon-o">
                :
               </span>
               <span class="crayon-h">
               </span>
               <span class="crayon-r">
                new
               </span>
               <span class="crayon-h">
               </span>
               <span class="crayon-e">
                Date
               </span>
               <span class="crayon-sy">
                (
               </span>
               <span class="crayon-cn">
                2013
               </span>
               <span class="crayon-sy">
                ,
               </span>
               <span class="crayon-cn">
                11
               </span>
               <span class="crayon-sy">
                ,
               </span>
               <span class="crayon-cn">
                11
               </span>
               <span class="crayon-sy">
                ,
               </span>
               <span class="crayon-cn">
                6
               </span>
               <span class="crayon-sy">
                ,
               </span>
               <span class="crayon-cn">
                20
               </span>
               <span class="crayon-sy">
                )
               </span>
               <span class="crayon-sy">
                ,
               </span>
              </div>
              <div class="crayon-line" id="crayon-5768647c9c577321603090-21">
               <span class="crayon-h">
               </span>
               <span class="crayon-v">
                like
               </span>
               <span class="crayon-o">
                :
               </span>
               <span class="crayon-h">
               </span>
               <span class="crayon-cn">
                0
               </span>
               <span class="crayon-h">
               </span>
              </div>
              <div class="crayon-line crayon-striped-line" id="crayon-5768647c9c577321603090-22">
               <span class="crayon-h">
               </span>
               <span class="crayon-sy">
                }
               </span>
              </div>
              <div class="crayon-line" id="crayon-5768647c9c577321603090-23">
               <span class="crayon-h">
               </span>
               <span class="crayon-sy">
                ]
               </span>
              </div>
              <div class="crayon-line crayon-striped-line" id="crayon-5768647c9c577321603090-24">
               <span class="crayon-sy">
                }
               </span>
              </div>
              <div class="crayon-line" id="crayon-5768647c9c577321603090-25">
               <span class="crayon-sy">
                )
               </span>
              </div>
              <div class="crayon-line crayon-striped-line" id="crayon-5768647c9c577321603090-26">
              </div>
             </div>
            </td>
           </tr>
          </tbody>
         </table>
        </div>
       </div>
       <!-- [Format Time: 0.0275 seconds] -->
       <p>
        请注意，这里插入数据之前，我们并不需要先声明movie这个集合里面有哪些项目。我们直接插入就可以了~这一点和SQL不一样，SQL必须先声明一个table里面有哪些列，而MongoDB不需要。
       </p>
       <p>
        把上面的例子复制进命令行应该可以顺利运行，但我强烈建议你手动打一下，或者输入一部你自己喜欢的电影。
        <code>
         insert
        </code>
        操作有几点需要注意：
       </p>
       <ul class="task-list">
        <li>
         1. 不同key-value需要用逗号隔开，而key:value中间是用冒号；
        </li>
        <li>
         2. 如果一个key有多个value，value要用[]。哪怕当前只有一个value，也加上[]以备后续的添加；
        </li>
        <li>
         3. 整个“数据块”要用{}括起来；
        </li>
       </ul>
       <p>
        如果你在
        <code>
         insert
        </code>
        之后看到
        <code>
         WriteResult({ "nInserted" : 1 })
        </code>
        ，说明写入成功。
       </p>
       <p>
        这个时候你可以用查询的方式来返回数据库中的数据：
       </p>
       <!-- Crayon Syntax Highlighter v_2.7.2_beta -->
       <div class="crayon-syntax crayon-theme-classic crayon-font-monaco crayon-os-pc print-yes notranslate" data-settings=" minimize scroll-mouseover" id="crayon-5768647c9c57e202495312" style=" margin-top: 12px; margin-bottom: 12px; font-size: 12px !important; line-height: 15px !important;">
        <div class="crayon-toolbar" data-settings=" mouseover overlay hide delay" style="font-size: 12px !important;height: 18px !important; line-height: 18px !important;">
         <span class="crayon-title">
         </span>
         <div class="crayon-tools" style="font-size: 12px !important;height: 18px !important; line-height: 18px !important;">
          <div class="crayon-button crayon-nums-button" title="切换是否显示行编号">
           <div class="crayon-button-icon">
           </div>
          </div>
          <div class="crayon-button crayon-plain-button" title="纯文本显示代码">
           <div class="crayon-button-icon">
           </div>
          </div>
          <div class="crayon-button crayon-wrap-button" title="切换自动换行">
           <div class="crayon-button-icon">
           </div>
          </div>
          <div class="crayon-button crayon-expand-button" title="点击展开代码">
           <div class="crayon-button-icon">
           </div>
          </div>
          <div class="crayon-button crayon-copy-button" title="复制代码">
           <div class="crayon-button-icon">
           </div>
          </div>
          <div class="crayon-button crayon-popup-button" title="在新窗口中显示代码">
           <div class="crayon-button-icon">
           </div>
          </div>
         </div>
        </div>
        <div class="crayon-info" style="min-height: 16.8px !important; line-height: 16.8px !important;">
        </div>
        <div class="crayon-plain-wrap">
         <textarea class="crayon-plain print-no" data-settings="dblclick" readonly="" style="-moz-tab-size:4; -o-tab-size:4; -webkit-tab-size:4; tab-size:4; font-size: 12px !important; line-height: 15px !important;" wrap="soft">
          db.movie.find().pretty()
         </textarea>
        </div>
        <div class="crayon-main" style="">
         <table class="crayon-table">
          <tbody>
           <tr class="crayon-row">
            <td class="crayon-nums " data-settings="show">
             <div class="crayon-nums-content" style="font-size: 12px !important; line-height: 15px !important;">
              <div class="crayon-num" data-line="crayon-5768647c9c57e202495312-1">
               1
              </div>
              <div class="crayon-num crayon-striped-num" data-line="crayon-5768647c9c57e202495312-2">
               2
              </div>
             </div>
            </td>
            <td class="crayon-code">
             <div class="crayon-pre" style="font-size: 12px !important; line-height: 15px !important; -moz-tab-size:4; -o-tab-size:4; -webkit-tab-size:4; tab-size:4;">
              <div class="crayon-line" id="crayon-5768647c9c57e202495312-1">
               <span class="crayon-v">
                db
               </span>
               <span class="crayon-sy">
                .
               </span>
               <span class="crayon-v">
                movie
               </span>
               <span class="crayon-sy">
                .
               </span>
               <span class="crayon-e">
                find
               </span>
               <span class="crayon-sy">
                (
               </span>
               <span class="crayon-sy">
                )
               </span>
               <span class="crayon-sy">
                .
               </span>
               <span class="crayon-e">
                pretty
               </span>
               <span class="crayon-sy">
                (
               </span>
               <span class="crayon-sy">
                )
               </span>
              </div>
              <div class="crayon-line crayon-striped-line" id="crayon-5768647c9c57e202495312-2">
              </div>
             </div>
            </td>
           </tr>
          </tbody>
         </table>
        </div>
       </div>
       <!-- [Format Time: 0.0009 seconds] -->
       <p>
        这里
        <code>
         find()
        </code>
        里面是空的，说明我们不做限制和筛选，类似于SQL没有
        <code>
         WHERE
        </code>
        语句一样。而
        <code>
         pretty()
        </code>
        输出的是经格式美化后的数据，你可以自己试试没有
        <code>
         pretty()
        </code>
        会怎么样。
       </p>
       <p>
        仔细观察
        <code>
         find()
        </code>
        的结果，你会发现多了一个叫
        <code>
         '_id'
        </code>
        的东西，这是数据库自动创建的一个ID号，在同一个数据库里，每个文件的ID号都是不同的。
       </p>
       <p>
        我们也可以同时输入多个数据：
       </p>
       <!-- Crayon Syntax Highlighter v_2.7.2_beta -->
       <div class="crayon-syntax crayon-theme-classic crayon-font-monaco crayon-os-pc print-yes notranslate" data-settings=" minimize scroll-mouseover" id="crayon-5768647c9c584761003358" style=" margin-top: 12px; margin-bottom: 12px; font-size: 12px !important; line-height: 15px !important;">
        <div class="crayon-toolbar" data-settings=" mouseover overlay hide delay" style="font-size: 12px !important;height: 18px !important; line-height: 18px !important;">
         <span class="crayon-title">
         </span>
         <div class="crayon-tools" style="font-size: 12px !important;height: 18px !important; line-height: 18px !important;">
          <div class="crayon-button crayon-nums-button" title="切换是否显示行编号">
           <div class="crayon-button-icon">
           </div>
          </div>
          <div class="crayon-button crayon-plain-button" title="纯文本显示代码">
           <div class="crayon-button-icon">
           </div>
          </div>
          <div class="crayon-button crayon-wrap-button" title="切换自动换行">
           <div class="crayon-button-icon">
           </div>
          </div>
          <div class="crayon-button crayon-expand-button" title="点击展开代码">
           <div class="crayon-button-icon">
           </div>
          </div>
          <div class="crayon-button crayon-copy-button" title="复制代码">
           <div class="crayon-button-icon">
           </div>
          </div>
          <div class="crayon-button crayon-popup-button" title="在新窗口中显示代码">
           <div class="crayon-button-icon">
           </div>
          </div>
         </div>
        </div>
        <div class="crayon-info" style="min-height: 16.8px !important; line-height: 16.8px !important;">
        </div>
        <div class="crayon-plain-wrap">
         <textarea class="crayon-plain print-no" data-settings="dblclick" readonly="" style="-moz-tab-size:4; -o-tab-size:4; -webkit-tab-size:4; tab-size:4; font-size: 12px !important; line-height: 15px !important;" wrap="soft">
          db.movie.insert([
 {
   title: 'Fight Club', 
   directed_by: 'David Fincher',
   stars: ['Brad Pitt', 'Edward Norton', 'Helena Bonham Carter'],
   tags: 'drama',
   debut: new Date(1999,10,15,0,0),
   likes: 224360,
   dislikes: 40127,
   comments: [  
      {
         user:'user3',
         message: 'My first comment',
         dateCreated: new Date(2008,09,13,2,35),
         like: 0 
      },
      {
         user:'user2',
         message: 'My first comment too!',
         dateCreated: new Date(2003,10,11,6,20),
         like: 14 
      },
      {
         user:'user7',
         message: 'Good Movie!',
         dateCreated: new Date(2009,10,11,6,20),
         like: 2
      }
   ]
},
{
   title: 'Seven', 
   directed_by: 'David Fincher',
   stars: ['Morgan Freeman', 'Brad Pitt',  'Kevin Spacey'],
   tags: ['drama','mystery','thiller'],
   debut: new Date(1995,9,22,0,0),
   likes: 134370,
   dislikes: 1037,
   comments: [  
      {
         user:'user3',
         message: 'Love Kevin Spacey',
         dateCreated: new Date(2002,09,13,2,35),
         like: 0 
      },
      {
         user:'user2',
         message: 'Good works!',
         dateCreated: new Date(2013,10,21,6,20),
         like: 14 
      },
      {
         user:'user7',
         message: 'Good Movie!',
         dateCreated: new Date(2009,10,11,6,20),
         like: 2
      }
   ]
}
])
         </textarea>
        </div>
        <div class="crayon-main" style="">
         <table class="crayon-table">
          <tbody>
           <tr class="crayon-row">
            <td class="crayon-nums " data-settings="show">
             <div class="crayon-nums-content" style="font-size: 12px !important; line-height: 15px !important;">
              <div class="crayon-num" data-line="crayon-5768647c9c584761003358-1">
               1
              </div>
              <div class="crayon-num crayon-striped-num" data-line="crayon-5768647c9c584761003358-2">
               2
              </div>
              <div class="crayon-num" data-line="crayon-5768647c9c584761003358-3">
               3
              </div>
              <div class="crayon-num crayon-striped-num" data-line="crayon-5768647c9c584761003358-4">
               4
              </div>
              <div class="crayon-num" data-line="crayon-5768647c9c584761003358-5">
               5
              </div>
              <div class="crayon-num crayon-striped-num" data-line="crayon-5768647c9c584761003358-6">
               6
              </div>
              <div class="crayon-num" data-line="crayon-5768647c9c584761003358-7">
               7
              </div>
              <div class="crayon-num crayon-striped-num" data-line="crayon-5768647c9c584761003358-8">
               8
              </div>
              <div class="crayon-num" data-line="crayon-5768647c9c584761003358-9">
               9
              </div>
              <div class="crayon-num crayon-striped-num" data-line="crayon-5768647c9c584761003358-10">
               10
              </div>
              <div class="crayon-num" data-line="crayon-5768647c9c584761003358-11">
               11
              </div>
              <div class="crayon-num crayon-striped-num" data-line="crayon-5768647c9c584761003358-12">
               12
              </div>
              <div class="crayon-num" data-line="crayon-5768647c9c584761003358-13">
               13
              </div>
              <div class="crayon-num crayon-striped-num" data-line="crayon-5768647c9c584761003358-14">
               14
              </div>
              <div class="crayon-num" data-line="crayon-5768647c9c584761003358-15">
               15
              </div>
              <div class="crayon-num crayon-striped-num" data-line="crayon-5768647c9c584761003358-16">
               16
              </div>
              <div class="crayon-num" data-line="crayon-5768647c9c584761003358-17">
               17
              </div>
              <div class="crayon-num crayon-striped-num" data-line="crayon-5768647c9c584761003358-18">
               18
              </div>
              <div class="crayon-num" data-line="crayon-5768647c9c584761003358-19">
               19
              </div>
              <div class="crayon-num crayon-striped-num" data-line="crayon-5768647c9c584761003358-20">
               20
              </div>
              <div class="crayon-num" data-line="crayon-5768647c9c584761003358-21">
               21
              </div>
              <div class="crayon-num crayon-striped-num" data-line="crayon-5768647c9c584761003358-22">
               22
              </div>
              <div class="crayon-num" data-line="crayon-5768647c9c584761003358-23">
               23
              </div>
              <div class="crayon-num crayon-striped-num" data-line="crayon-5768647c9c584761003358-24">
               24
              </div>
              <div class="crayon-num" data-line="crayon-5768647c9c584761003358-25">
               25
              </div>
              <div class="crayon-num crayon-striped-num" data-line="crayon-5768647c9c584761003358-26">
               26
              </div>
              <div class="crayon-num" data-line="crayon-5768647c9c584761003358-27">
               27
              </div>
              <div class="crayon-num crayon-striped-num" data-line="crayon-5768647c9c584761003358-28">
               28
              </div>
              <div class="crayon-num" data-line="crayon-5768647c9c584761003358-29">
               29
              </div>
              <div class="crayon-num crayon-striped-num" data-line="crayon-5768647c9c584761003358-30">
               30
              </div>
              <div class="crayon-num" data-line="crayon-5768647c9c584761003358-31">
               31
              </div>
              <div class="crayon-num crayon-striped-num" data-line="crayon-5768647c9c584761003358-32">
               32
              </div>
              <div class="crayon-num" data-line="crayon-5768647c9c584761003358-33">
               33
              </div>
              <div class="crayon-num crayon-striped-num" data-line="crayon-5768647c9c584761003358-34">
               34
              </div>
              <div class="crayon-num" data-line="crayon-5768647c9c584761003358-35">
               35
              </div>
              <div class="crayon-num crayon-striped-num" data-line="crayon-5768647c9c584761003358-36">
               36
              </div>
              <div class="crayon-num" data-line="crayon-5768647c9c584761003358-37">
               37
              </div>
              <div class="crayon-num crayon-striped-num" data-line="crayon-5768647c9c584761003358-38">
               38
              </div>
              <div class="crayon-num" data-line="crayon-5768647c9c584761003358-39">
               39
              </div>
              <div class="crayon-num crayon-striped-num" data-line="crayon-5768647c9c584761003358-40">
               40
              </div>
              <div class="crayon-num" data-line="crayon-5768647c9c584761003358-41">
               41
              </div>
              <div class="crayon-num crayon-striped-num" data-line="crayon-5768647c9c584761003358-42">
               42
              </div>
              <div class="crayon-num" data-line="crayon-5768647c9c584761003358-43">
               43
              </div>
              <div class="crayon-num crayon-striped-num" data-line="crayon-5768647c9c584761003358-44">
               44
              </div>
              <div class="crayon-num" data-line="crayon-5768647c9c584761003358-45">
               45
              </div>
              <div class="crayon-num crayon-striped-num" data-line="crayon-5768647c9c584761003358-46">
               46
              </div>
              <div class="crayon-num" data-line="crayon-5768647c9c584761003358-47">
               47
              </div>
              <div class="crayon-num crayon-striped-num" data-line="crayon-5768647c9c584761003358-48">
               48
              </div>
              <div class="crayon-num" data-line="crayon-5768647c9c584761003358-49">
               49
              </div>
              <div class="crayon-num crayon-striped-num" data-line="crayon-5768647c9c584761003358-50">
               50
              </div>
              <div class="crayon-num" data-line="crayon-5768647c9c584761003358-51">
               51
              </div>
              <div class="crayon-num crayon-striped-num" data-line="crayon-5768647c9c584761003358-52">
               52
              </div>
              <div class="crayon-num" data-line="crayon-5768647c9c584761003358-53">
               53
              </div>
              <div class="crayon-num crayon-striped-num" data-line="crayon-5768647c9c584761003358-54">
               54
              </div>
              <div class="crayon-num" data-line="crayon-5768647c9c584761003358-55">
               55
              </div>
              <div class="crayon-num crayon-striped-num" data-line="crayon-5768647c9c584761003358-56">
               56
              </div>
              <div class="crayon-num" data-line="crayon-5768647c9c584761003358-57">
               57
              </div>
              <div class="crayon-num crayon-striped-num" data-line="crayon-5768647c9c584761003358-58">
               58
              </div>
              <div class="crayon-num" data-line="crayon-5768647c9c584761003358-59">
               59
              </div>
              <div class="crayon-num crayon-striped-num" data-line="crayon-5768647c9c584761003358-60">
               60
              </div>
              <div class="crayon-num" data-line="crayon-5768647c9c584761003358-61">
               61
              </div>
             </div>
            </td>
            <td class="crayon-code">
             <div class="crayon-pre" style="font-size: 12px !important; line-height: 15px !important; -moz-tab-size:4; -o-tab-size:4; -webkit-tab-size:4; tab-size:4;">
              <div class="crayon-line" id="crayon-5768647c9c584761003358-1">
               <span class="crayon-v">
                db
               </span>
               <span class="crayon-sy">
                .
               </span>
               <span class="crayon-v">
                movie
               </span>
               <span class="crayon-sy">
                .
               </span>
               <span class="crayon-e">
                insert
               </span>
               <span class="crayon-sy">
                (
               </span>
               <span class="crayon-sy">
                [
               </span>
              </div>
              <div class="crayon-line crayon-striped-line" id="crayon-5768647c9c584761003358-2">
               <span class="crayon-h">
               </span>
               <span class="crayon-sy">
                {
               </span>
              </div>
              <div class="crayon-line" id="crayon-5768647c9c584761003358-3">
               <span class="crayon-h">
               </span>
               <span class="crayon-v">
                title
               </span>
               <span class="crayon-o">
                :
               </span>
               <span class="crayon-h">
               </span>
               <span class="crayon-s">
                'Fight Club'
               </span>
               <span class="crayon-sy">
                ,
               </span>
               <span class="crayon-h">
               </span>
              </div>
              <div class="crayon-line crayon-striped-line" id="crayon-5768647c9c584761003358-4">
               <span class="crayon-h">
               </span>
               <span class="crayon-v">
                directed_by
               </span>
               <span class="crayon-o">
                :
               </span>
               <span class="crayon-h">
               </span>
               <span class="crayon-s">
                'David Fincher'
               </span>
               <span class="crayon-sy">
                ,
               </span>
              </div>
              <div class="crayon-line" id="crayon-5768647c9c584761003358-5">
               <span class="crayon-h">
               </span>
               <span class="crayon-v">
                stars
               </span>
               <span class="crayon-o">
                :
               </span>
               <span class="crayon-h">
               </span>
               <span class="crayon-sy">
                [
               </span>
               <span class="crayon-s">
                'Brad Pitt'
               </span>
               <span class="crayon-sy">
                ,
               </span>
               <span class="crayon-h">
               </span>
               <span class="crayon-s">
                'Edward Norton'
               </span>
               <span class="crayon-sy">
                ,
               </span>
               <span class="crayon-h">
               </span>
               <span class="crayon-s">
                'Helena Bonham Carter'
               </span>
               <span class="crayon-sy">
                ]
               </span>
               <span class="crayon-sy">
                ,
               </span>
              </div>
              <div class="crayon-line crayon-striped-line" id="crayon-5768647c9c584761003358-6">
               <span class="crayon-h">
               </span>
               <span class="crayon-v">
                tags
               </span>
               <span class="crayon-o">
                :
               </span>
               <span class="crayon-h">
               </span>
               <span class="crayon-s">
                'drama'
               </span>
               <span class="crayon-sy">
                ,
               </span>
              </div>
              <div class="crayon-line" id="crayon-5768647c9c584761003358-7">
               <span class="crayon-h">
               </span>
               <span class="crayon-v">
                debut
               </span>
               <span class="crayon-o">
                :
               </span>
               <span class="crayon-h">
               </span>
               <span class="crayon-r">
                new
               </span>
               <span class="crayon-h">
               </span>
               <span class="crayon-e">
                Date
               </span>
               <span class="crayon-sy">
                (
               </span>
               <span class="crayon-cn">
                1999
               </span>
               <span class="crayon-sy">
                ,
               </span>
               <span class="crayon-cn">
                10
               </span>
               <span class="crayon-sy">
                ,
               </span>
               <span class="crayon-cn">
                15
               </span>
               <span class="crayon-sy">
                ,
               </span>
               <span class="crayon-cn">
                0
               </span>
               <span class="crayon-sy">
                ,
               </span>
               <span class="crayon-cn">
                0
               </span>
               <span class="crayon-sy">
                )
               </span>
               <span class="crayon-sy">
                ,
               </span>
              </div>
              <div class="crayon-line crayon-striped-line" id="crayon-5768647c9c584761003358-8">
               <span class="crayon-h">
               </span>
               <span class="crayon-v">
                likes
               </span>
               <span class="crayon-o">
                :
               </span>
               <span class="crayon-h">
               </span>
               <span class="crayon-cn">
                224360
               </span>
               <span class="crayon-sy">
                ,
               </span>
              </div>
              <div class="crayon-line" id="crayon-5768647c9c584761003358-9">
               <span class="crayon-h">
               </span>
               <span class="crayon-v">
                dislikes
               </span>
               <span class="crayon-o">
                :
               </span>
               <span class="crayon-h">
               </span>
               <span class="crayon-cn">
                40127
               </span>
               <span class="crayon-sy">
                ,
               </span>
              </div>
              <div class="crayon-line crayon-striped-line" id="crayon-5768647c9c584761003358-10">
               <span class="crayon-h">
               </span>
               <span class="crayon-v">
                comments
               </span>
               <span class="crayon-o">
                :
               </span>
               <span class="crayon-h">
               </span>
               <span class="crayon-sy">
                [
               </span>
               <span class="crayon-h">
               </span>
              </div>
              <div class="crayon-line" id="crayon-5768647c9c584761003358-11">
               <span class="crayon-h">
               </span>
               <span class="crayon-sy">
                {
               </span>
              </div>
              <div class="crayon-line crayon-striped-line" id="crayon-5768647c9c584761003358-12">
               <span class="crayon-h">
               </span>
               <span class="crayon-v">
                user
               </span>
               <span class="crayon-o">
                :
               </span>
               <span class="crayon-s">
                'user3'
               </span>
               <span class="crayon-sy">
                ,
               </span>
              </div>
              <div class="crayon-line" id="crayon-5768647c9c584761003358-13">
               <span class="crayon-h">
               </span>
               <span class="crayon-v">
                message
               </span>
               <span class="crayon-o">
                :
               </span>
               <span class="crayon-h">
               </span>
               <span class="crayon-s">
                'My first comment'
               </span>
               <span class="crayon-sy">
                ,
               </span>
              </div>
              <div class="crayon-line crayon-striped-line" id="crayon-5768647c9c584761003358-14">
               <span class="crayon-h">
               </span>
               <span class="crayon-v">
                dateCreated
               </span>
               <span class="crayon-o">
                :
               </span>
               <span class="crayon-h">
               </span>
               <span class="crayon-r">
                new
               </span>
               <span class="crayon-h">
               </span>
               <span class="crayon-e">
                Date
               </span>
               <span class="crayon-sy">
                (
               </span>
               <span class="crayon-cn">
                2008
               </span>
               <span class="crayon-sy">
                ,
               </span>
               <span class="crayon-cn">
                09
               </span>
               <span class="crayon-sy">
                ,
               </span>
               <span class="crayon-cn">
                13
               </span>
               <span class="crayon-sy">
                ,
               </span>
               <span class="crayon-cn">
                2
               </span>
               <span class="crayon-sy">
                ,
               </span>
               <span class="crayon-cn">
                35
               </span>
               <span class="crayon-sy">
                )
               </span>
               <span class="crayon-sy">
                ,
               </span>
              </div>
              <div class="crayon-line" id="crayon-5768647c9c584761003358-15">
               <span class="crayon-h">
               </span>
               <span class="crayon-v">
                like
               </span>
               <span class="crayon-o">
                :
               </span>
               <span class="crayon-h">
               </span>
               <span class="crayon-cn">
                0
               </span>
               <span class="crayon-h">
               </span>
              </div>
              <div class="crayon-line crayon-striped-line" id="crayon-5768647c9c584761003358-16">
               <span class="crayon-h">
               </span>
               <span class="crayon-sy">
                }
               </span>
               <span class="crayon-sy">
                ,
               </span>
              </div>
              <div class="crayon-line" id="crayon-5768647c9c584761003358-17">
               <span class="crayon-h">
               </span>
               <span class="crayon-sy">
                {
               </span>
              </div>
              <div class="crayon-line crayon-striped-line" id="crayon-5768647c9c584761003358-18">
               <span class="crayon-h">
               </span>
               <span class="crayon-v">
                user
               </span>
               <span class="crayon-o">
                :
               </span>
               <span class="crayon-s">
                'user2'
               </span>
               <span class="crayon-sy">
                ,
               </span>
              </div>
              <div class="crayon-line" id="crayon-5768647c9c584761003358-19">
               <span class="crayon-h">
               </span>
               <span class="crayon-v">
                message
               </span>
               <span class="crayon-o">
                :
               </span>
               <span class="crayon-h">
               </span>
               <span class="crayon-s">
                'My first comment too!'
               </span>
               <span class="crayon-sy">
                ,
               </span>
              </div>
              <div class="crayon-line crayon-striped-line" id="crayon-5768647c9c584761003358-20">
               <span class="crayon-h">
               </span>
               <span class="crayon-v">
                dateCreated
               </span>
               <span class="crayon-o">
                :
               </span>
               <span class="crayon-h">
               </span>
               <span class="crayon-r">
                new
               </span>
               <span class="crayon-h">
               </span>
               <span class="crayon-e">
                Date
               </span>
               <span class="crayon-sy">
                (
               </span>
               <span class="crayon-cn">
                2003
               </span>
               <span class="crayon-sy">
                ,
               </span>
               <span class="crayon-cn">
                10
               </span>
               <span class="crayon-sy">
                ,
               </span>
               <span class="crayon-cn">
                11
               </span>
               <span class="crayon-sy">
                ,
               </span>
               <span class="crayon-cn">
                6
               </span>
               <span class="crayon-sy">
                ,
               </span>
               <span class="crayon-cn">
                20
               </span>
               <span class="crayon-sy">
                )
               </span>
               <span class="crayon-sy">
                ,
               </span>
              </div>
              <div class="crayon-line" id="crayon-5768647c9c584761003358-21">
               <span class="crayon-h">
               </span>
               <span class="crayon-v">
                like
               </span>
               <span class="crayon-o">
                :
               </span>
               <span class="crayon-h">
               </span>
               <span class="crayon-cn">
                14
               </span>
               <span class="crayon-h">
               </span>
              </div>
              <div class="crayon-line crayon-striped-line" id="crayon-5768647c9c584761003358-22">
               <span class="crayon-h">
               </span>
               <span class="crayon-sy">
                }
               </span>
               <span class="crayon-sy">
                ,
               </span>
              </div>
              <div class="crayon-line" id="crayon-5768647c9c584761003358-23">
               <span class="crayon-h">
               </span>
               <span class="crayon-sy">
                {
               </span>
              </div>
              <div class="crayon-line crayon-striped-line" id="crayon-5768647c9c584761003358-24">
               <span class="crayon-h">
               </span>
               <span class="crayon-v">
                user
               </span>
               <span class="crayon-o">
                :
               </span>
               <span class="crayon-s">
                'user7'
               </span>
               <span class="crayon-sy">
                ,
               </span>
              </div>
              <div class="crayon-line" id="crayon-5768647c9c584761003358-25">
               <span class="crayon-h">
               </span>
               <span class="crayon-v">
                message
               </span>
               <span class="crayon-o">
                :
               </span>
               <span class="crayon-h">
               </span>
               <span class="crayon-s">
                'Good Movie!'
               </span>
               <span class="crayon-sy">
                ,
               </span>
              </div>
              <div class="crayon-line crayon-striped-line" id="crayon-5768647c9c584761003358-26">
               <span class="crayon-h">
               </span>
               <span class="crayon-v">
                dateCreated
               </span>
               <span class="crayon-o">
                :
               </span>
               <span class="crayon-h">
               </span>
               <span class="crayon-r">
                new
               </span>
               <span class="crayon-h">
               </span>
               <span class="crayon-e">
                Date
               </span>
               <span class="crayon-sy">
                (
               </span>
               <span class="crayon-cn">
                2009
               </span>
               <span class="crayon-sy">
                ,
               </span>
               <span class="crayon-cn">
                10
               </span>
               <span class="crayon-sy">
                ,
               </span>
               <span class="crayon-cn">
                11
               </span>
               <span class="crayon-sy">
                ,
               </span>
               <span class="crayon-cn">
                6
               </span>
               <span class="crayon-sy">
                ,
               </span>
               <span class="crayon-cn">
                20
               </span>
               <span class="crayon-sy">
                )
               </span>
               <span class="crayon-sy">
                ,
               </span>
              </div>
              <div class="crayon-line" id="crayon-5768647c9c584761003358-27">
               <span class="crayon-h">
               </span>
               <span class="crayon-v">
                like
               </span>
               <span class="crayon-o">
                :
               </span>
               <span class="crayon-h">
               </span>
               <span class="crayon-cn">
                2
               </span>
              </div>
              <div class="crayon-line crayon-striped-line" id="crayon-5768647c9c584761003358-28">
               <span class="crayon-h">
               </span>
               <span class="crayon-sy">
                }
               </span>
              </div>
              <div class="crayon-line" id="crayon-5768647c9c584761003358-29">
               <span class="crayon-h">
               </span>
               <span class="crayon-sy">
                ]
               </span>
              </div>
              <div class="crayon-line crayon-striped-line" id="crayon-5768647c9c584761003358-30">
               <span class="crayon-sy">
                }
               </span>
               <span class="crayon-sy">
                ,
               </span>
              </div>
              <div class="crayon-line" id="crayon-5768647c9c584761003358-31">
               <span class="crayon-sy">
                {
               </span>
              </div>
              <div class="crayon-line crayon-striped-line" id="crayon-5768647c9c584761003358-32">
               <span class="crayon-h">
               </span>
               <span class="crayon-v">
                title
               </span>
               <span class="crayon-o">
                :
               </span>
               <span class="crayon-h">
               </span>
               <span class="crayon-s">
                'Seven'
               </span>
               <span class="crayon-sy">
                ,
               </span>
               <span class="crayon-h">
               </span>
              </div>
              <div class="crayon-line" id="crayon-5768647c9c584761003358-33">
               <span class="crayon-h">
               </span>
               <span class="crayon-v">
                directed_by
               </span>
               <span class="crayon-o">
                :
               </span>
               <span class="crayon-h">
               </span>
               <span class="crayon-s">
                'David Fincher'
               </span>
               <span class="crayon-sy">
                ,
               </span>
              </div>
              <div class="crayon-line crayon-striped-line" id="crayon-5768647c9c584761003358-34">
               <span class="crayon-h">
               </span>
               <span class="crayon-v">
                stars
               </span>
               <span class="crayon-o">
                :
               </span>
               <span class="crayon-h">
               </span>
               <span class="crayon-sy">
                [
               </span>
               <span class="crayon-s">
                'Morgan Freeman'
               </span>
               <span class="crayon-sy">
                ,
               </span>
               <span class="crayon-h">
               </span>
               <span class="crayon-s">
                'Brad Pitt'
               </span>
               <span class="crayon-sy">
                ,
               </span>
               <span class="crayon-h">
               </span>
               <span class="crayon-s">
                'Kevin Spacey'
               </span>
               <span class="crayon-sy">
                ]
               </span>
               <span class="crayon-sy">
                ,
               </span>
              </div>
              <div class="crayon-line" id="crayon-5768647c9c584761003358-35">
               <span class="crayon-h">
               </span>
               <span class="crayon-v">
                tags
               </span>
               <span class="crayon-o">
                :
               </span>
               <span class="crayon-h">
               </span>
               <span class="crayon-sy">
                [
               </span>
               <span class="crayon-s">
                'drama'
               </span>
               <span class="crayon-sy">
                ,
               </span>
               <span class="crayon-s">
                'mystery'
               </span>
               <span class="crayon-sy">
                ,
               </span>
               <span class="crayon-s">
                'thiller'
               </span>
               <span class="crayon-sy">
                ]
               </span>
               <span class="crayon-sy">
                ,
               </span>
              </div>
              <div class="crayon-line crayon-striped-line" id="crayon-5768647c9c584761003358-36">
               <span class="crayon-h">
               </span>
               <span class="crayon-v">
                debut
               </span>
               <span class="crayon-o">
                :
               </span>
               <span class="crayon-h">
               </span>
               <span class="crayon-r">
                new
               </span>
               <span class="crayon-h">
               </span>
               <span class="crayon-e">
                Date
               </span>
               <span class="crayon-sy">
                (
               </span>
               <span class="crayon-cn">
                1995
               </span>
               <span class="crayon-sy">
                ,
               </span>
               <span class="crayon-cn">
                9
               </span>
               <span class="crayon-sy">
                ,
               </span>
               <span class="crayon-cn">
                22
               </span>
               <span class="crayon-sy">
                ,
               </span>
               <span class="crayon-cn">
                0
               </span>
               <span class="crayon-sy">
                ,
               </span>
               <span class="crayon-cn">
                0
               </span>
               <span class="crayon-sy">
                )
               </span>
               <span class="crayon-sy">
                ,
               </span>
              </div>
              <div class="crayon-line" id="crayon-5768647c9c584761003358-37">
               <span class="crayon-h">
               </span>
               <span class="crayon-v">
                likes
               </span>
               <span class="crayon-o">
                :
               </span>
               <span class="crayon-h">
               </span>
               <span class="crayon-cn">
                134370
               </span>
               <span class="crayon-sy">
                ,
               </span>
              </div>
              <div class="crayon-line crayon-striped-line" id="crayon-5768647c9c584761003358-38">
               <span class="crayon-h">
               </span>
               <span class="crayon-v">
                dislikes
               </span>
               <span class="crayon-o">
                :
               </span>
               <span class="crayon-h">
               </span>
               <span class="crayon-cn">
                1037
               </span>
               <span class="crayon-sy">
                ,
               </span>
              </div>
              <div class="crayon-line" id="crayon-5768647c9c584761003358-39">
               <span class="crayon-h">
               </span>
               <span class="crayon-v">
                comments
               </span>
               <span class="crayon-o">
                :
               </span>
               <span class="crayon-h">
               </span>
               <span class="crayon-sy">
                [
               </span>
               <span class="crayon-h">
               </span>
              </div>
              <div class="crayon-line crayon-striped-line" id="crayon-5768647c9c584761003358-40">
               <span class="crayon-h">
               </span>
               <span class="crayon-sy">
                {
               </span>
              </div>
              <div class="crayon-line" id="crayon-5768647c9c584761003358-41">
               <span class="crayon-h">
               </span>
               <span class="crayon-v">
                user
               </span>
               <span class="crayon-o">
                :
               </span>
               <span class="crayon-s">
                'user3'
               </span>
               <span class="crayon-sy">
                ,
               </span>
              </div>
              <div class="crayon-line crayon-striped-line" id="crayon-5768647c9c584761003358-42">
               <span class="crayon-h">
               </span>
               <span class="crayon-v">
                message
               </span>
               <span class="crayon-o">
                :
               </span>
               <span class="crayon-h">
               </span>
               <span class="crayon-s">
                'Love Kevin Spacey'
               </span>
               <span class="crayon-sy">
                ,
               </span>
              </div>
              <div class="crayon-line" id="crayon-5768647c9c584761003358-43">
               <span class="crayon-h">
               </span>
               <span class="crayon-v">
                dateCreated
               </span>
               <span class="crayon-o">
                :
               </span>
               <span class="crayon-h">
               </span>
               <span class="crayon-r">
                new
               </span>
               <span class="crayon-h">
               </span>
               <span class="crayon-e">
                Date
               </span>
               <span class="crayon-sy">
                (
               </span>
               <span class="crayon-cn">
                2002
               </span>
               <span class="crayon-sy">
                ,
               </span>
               <span class="crayon-cn">
                09
               </span>
               <span class="crayon-sy">
                ,
               </span>
               <span class="crayon-cn">
                13
               </span>
               <span class="crayon-sy">
                ,
               </span>
               <span class="crayon-cn">
                2
               </span>
               <span class="crayon-sy">
                ,
               </span>
               <span class="crayon-cn">
                35
               </span>
               <span class="crayon-sy">
                )
               </span>
               <span class="crayon-sy">
                ,
               </span>
              </div>
              <div class="crayon-line crayon-striped-line" id="crayon-5768647c9c584761003358-44">
               <span class="crayon-h">
               </span>
               <span class="crayon-v">
                like
               </span>
               <span class="crayon-o">
                :
               </span>
               <span class="crayon-h">
               </span>
               <span class="crayon-cn">
                0
               </span>
               <span class="crayon-h">
               </span>
              </div>
              <div class="crayon-line" id="crayon-5768647c9c584761003358-45">
               <span class="crayon-h">
               </span>
               <span class="crayon-sy">
                }
               </span>
               <span class="crayon-sy">
                ,
               </span>
              </div>
              <div class="crayon-line crayon-striped-line" id="crayon-5768647c9c584761003358-46">
               <span class="crayon-h">
               </span>
               <span class="crayon-sy">
                {
               </span>
              </div>
              <div class="crayon-line" id="crayon-5768647c9c584761003358-47">
               <span class="crayon-h">
               </span>
               <span class="crayon-v">
                user
               </span>
               <span class="crayon-o">
                :
               </span>
               <span class="crayon-s">
                'user2'
               </span>
               <span class="crayon-sy">
                ,
               </span>
              </div>
              <div class="crayon-line crayon-striped-line" id="crayon-5768647c9c584761003358-48">
               <span class="crayon-h">
               </span>
               <span class="crayon-v">
                message
               </span>
               <span class="crayon-o">
                :
               </span>
               <span class="crayon-h">
               </span>
               <span class="crayon-s">
                'Good works!'
               </span>
               <span class="crayon-sy">
                ,
               </span>
              </div>
              <div class="crayon-line" id="crayon-5768647c9c584761003358-49">
               <span class="crayon-h">
               </span>
               <span class="crayon-v">
                dateCreated
               </span>
               <span class="crayon-o">
                :
               </span>
               <span class="crayon-h">
               </span>
               <span class="crayon-r">
                new
               </span>
               <span class="crayon-h">
               </span>
               <span class="crayon-e">
                Date
               </span>
               <span class="crayon-sy">
                (
               </span>
               <span class="crayon-cn">
                2013
               </span>
               <span class="crayon-sy">
                ,
               </span>
               <span class="crayon-cn">
                10
               </span>
               <span class="crayon-sy">
                ,
               </span>
               <span class="crayon-cn">
                21
               </span>
               <span class="crayon-sy">
                ,
               </span>
               <span class="crayon-cn">
                6
               </span>
               <span class="crayon-sy">
                ,
               </span>
               <span class="crayon-cn">
                20
               </span>
               <span class="crayon-sy">
                )
               </span>
               <span class="crayon-sy">
                ,
               </span>
              </div>
              <div class="crayon-line crayon-striped-line" id="crayon-5768647c9c584761003358-50">
               <span class="crayon-h">
               </span>
               <span class="crayon-v">
                like
               </span>
               <span class="crayon-o">
                :
               </span>
               <span class="crayon-h">
               </span>
               <span class="crayon-cn">
                14
               </span>
               <span class="crayon-h">
               </span>
              </div>
              <div class="crayon-line" id="crayon-5768647c9c584761003358-51">
               <span class="crayon-h">
               </span>
               <span class="crayon-sy">
                }
               </span>
               <span class="crayon-sy">
                ,
               </span>
              </div>
              <div class="crayon-line crayon-striped-line" id="crayon-5768647c9c584761003358-52">
               <span class="crayon-h">
               </span>
               <span class="crayon-sy">
                {
               </span>
              </div>
              <div class="crayon-line" id="crayon-5768647c9c584761003358-53">
               <span class="crayon-h">
               </span>
               <span class="crayon-v">
                user
               </span>
               <span class="crayon-o">
                :
               </span>
               <span class="crayon-s">
                'user7'
               </span>
               <span class="crayon-sy">
                ,
               </span>
              </div>
              <div class="crayon-line crayon-striped-line" id="crayon-5768647c9c584761003358-54">
               <span class="crayon-h">
               </span>
               <span class="crayon-v">
                message
               </span>
               <span class="crayon-o">
                :
               </span>
               <span class="crayon-h">
               </span>
               <span class="crayon-s">
                'Good Movie!'
               </span>
               <span class="crayon-sy">
                ,
               </span>
              </div>
              <div class="crayon-line" id="crayon-5768647c9c584761003358-55">
               <span class="crayon-h">
               </span>
               <span class="crayon-v">
                dateCreated
               </span>
               <span class="crayon-o">
                :
               </span>
               <span class="crayon-h">
               </span>
               <span class="crayon-r">
                new
               </span>
               <span class="crayon-h">
               </span>
               <span class="crayon-e">
                Date
               </span>
               <span class="crayon-sy">
                (
               </span>
               <span class="crayon-cn">
                2009
               </span>
               <span class="crayon-sy">
                ,
               </span>
               <span class="crayon-cn">
                10
               </span>
               <span class="crayon-sy">
                ,
               </span>
               <span class="crayon-cn">
                11
               </span>
               <span class="crayon-sy">
                ,
               </span>
               <span class="crayon-cn">
                6
               </span>
               <span class="crayon-sy">
                ,
               </span>
               <span class="crayon-cn">
                20
               </span>
               <span class="crayon-sy">
                )
               </span>
               <span class="crayon-sy">
                ,
               </span>
              </div>
              <div class="crayon-line crayon-striped-line" id="crayon-5768647c9c584761003358-56">
               <span class="crayon-h">
               </span>
               <span class="crayon-v">
                like
               </span>
               <span class="crayon-o">
                :
               </span>
               <span class="crayon-h">
               </span>
               <span class="crayon-cn">
                2
               </span>
              </div>
              <div class="crayon-line" id="crayon-5768647c9c584761003358-57">
               <span class="crayon-h">
               </span>
               <span class="crayon-sy">
                }
               </span>
              </div>
              <div class="crayon-line crayon-striped-line" id="crayon-5768647c9c584761003358-58">
               <span class="crayon-h">
               </span>
               <span class="crayon-sy">
                ]
               </span>
              </div>
              <div class="crayon-line" id="crayon-5768647c9c584761003358-59">
               <span class="crayon-sy">
                }
               </span>
              </div>
              <div class="crayon-line crayon-striped-line" id="crayon-5768647c9c584761003358-60">
               <span class="crayon-sy">
                ]
               </span>
               <span class="crayon-sy">
                )
               </span>
              </div>
              <div class="crayon-line" id="crayon-5768647c9c584761003358-61">
              </div>
             </div>
            </td>
           </tr>
          </tbody>
         </table>
        </div>
       </div>
       <!-- [Format Time: 0.0140 seconds] -->
       <p>
        顺利的话会显示：
       </p>
       <!-- Crayon Syntax Highlighter v_2.7.2_beta -->
       <div class="crayon-syntax crayon-theme-classic crayon-font-monaco crayon-os-pc print-yes notranslate" data-settings=" minimize scroll-mouseover" id="crayon-5768647c9c58c483289647" style=" margin-top: 12px; margin-bottom: 12px; font-size: 12px !important; line-height: 15px !important;">
        <div class="crayon-toolbar" data-settings=" mouseover overlay hide delay" style="font-size: 12px !important;height: 18px !important; line-height: 18px !important;">
         <span class="crayon-title">
         </span>
         <div class="crayon-tools" style="font-size: 12px !important;height: 18px !important; line-height: 18px !important;">
          <div class="crayon-button crayon-nums-button" title="切换是否显示行编号">
           <div class="crayon-button-icon">
           </div>
          </div>
          <div class="crayon-button crayon-plain-button" title="纯文本显示代码">
           <div class="crayon-button-icon">
           </div>
          </div>
          <div class="crayon-button crayon-wrap-button" title="切换自动换行">
           <div class="crayon-button-icon">
           </div>
          </div>
          <div class="crayon-button crayon-expand-button" title="点击展开代码">
           <div class="crayon-button-icon">
           </div>
          </div>
          <div class="crayon-button crayon-copy-button" title="复制代码">
           <div class="crayon-button-icon">
           </div>
          </div>
          <div class="crayon-button crayon-popup-button" title="在新窗口中显示代码">
           <div class="crayon-button-icon">
           </div>
          </div>
         </div>
        </div>
        <div class="crayon-info" style="min-height: 16.8px !important; line-height: 16.8px !important;">
        </div>
        <div class="crayon-plain-wrap">
         <textarea class="crayon-plain print-no" data-settings="dblclick" readonly="" style="-moz-tab-size:4; -o-tab-size:4; -webkit-tab-size:4; tab-size:4; font-size: 12px !important; line-height: 15px !important;" wrap="soft">
          BulkWriteResult({
    "writeErrors" : [ ],
    "writeConcernErrors" : [ ],
    "nInserted" : 2,
    "nUpserted" : 0,
    "nMatched" : 0,
    "nModified" : 0,
    "nRemoved" : 0,
    "upserted" : [ ]
         </textarea>
        </div>
        <div class="crayon-main" style="">
         <table class="crayon-table">
          <tbody>
           <tr class="crayon-row">
            <td class="crayon-nums " data-settings="show">
             <div class="crayon-nums-content" style="font-size: 12px !important; line-height: 15px !important;">
              <div class="crayon-num" data-line="crayon-5768647c9c58c483289647-1">
               1
              </div>
              <div class="crayon-num crayon-striped-num" data-line="crayon-5768647c9c58c483289647-2">
               2
              </div>
              <div class="crayon-num" data-line="crayon-5768647c9c58c483289647-3">
               3
              </div>
              <div class="crayon-num crayon-striped-num" data-line="crayon-5768647c9c58c483289647-4">
               4
              </div>
              <div class="crayon-num" data-line="crayon-5768647c9c58c483289647-5">
               5
              </div>
              <div class="crayon-num crayon-striped-num" data-line="crayon-5768647c9c58c483289647-6">
               6
              </div>
              <div class="crayon-num" data-line="crayon-5768647c9c58c483289647-7">
               7
              </div>
              <div class="crayon-num crayon-striped-num" data-line="crayon-5768647c9c58c483289647-8">
               8
              </div>
              <div class="crayon-num" data-line="crayon-5768647c9c58c483289647-9">
               9
              </div>
              <div class="crayon-num crayon-striped-num" data-line="crayon-5768647c9c58c483289647-10">
               10
              </div>
             </div>
            </td>
            <td class="crayon-code">
             <div class="crayon-pre" style="font-size: 12px !important; line-height: 15px !important; -moz-tab-size:4; -o-tab-size:4; -webkit-tab-size:4; tab-size:4;">
              <div class="crayon-line" id="crayon-5768647c9c58c483289647-1">
               <span class="crayon-e">
                BulkWriteResult
               </span>
               <span class="crayon-sy">
                (
               </span>
               <span class="crayon-sy">
                {
               </span>
              </div>
              <div class="crayon-line crayon-striped-line" id="crayon-5768647c9c58c483289647-2">
               <span class="crayon-h">
               </span>
               <span class="crayon-s">
                "writeErrors"
               </span>
               <span class="crayon-h">
               </span>
               <span class="crayon-o">
                :
               </span>
               <span class="crayon-h">
               </span>
               <span class="crayon-sy">
                [
               </span>
               <span class="crayon-h">
               </span>
               <span class="crayon-sy">
                ]
               </span>
               <span class="crayon-sy">
                ,
               </span>
              </div>
              <div class="crayon-line" id="crayon-5768647c9c58c483289647-3">
               <span class="crayon-h">
               </span>
               <span class="crayon-s">
                "writeConcernErrors"
               </span>
               <span class="crayon-h">
               </span>
               <span class="crayon-o">
                :
               </span>
               <span class="crayon-h">
               </span>
               <span class="crayon-sy">
                [
               </span>
               <span class="crayon-h">
               </span>
               <span class="crayon-sy">
                ]
               </span>
               <span class="crayon-sy">
                ,
               </span>
              </div>
              <div class="crayon-line crayon-striped-line" id="crayon-5768647c9c58c483289647-4">
               <span class="crayon-h">
               </span>
               <span class="crayon-s">
                "nInserted"
               </span>
               <span class="crayon-h">
               </span>
               <span class="crayon-o">
                :
               </span>
               <span class="crayon-h">
               </span>
               <span class="crayon-cn">
                2
               </span>
               <span class="crayon-sy">
                ,
               </span>
              </div>
              <div class="crayon-line" id="crayon-5768647c9c58c483289647-5">
               <span class="crayon-h">
               </span>
               <span class="crayon-s">
                "nUpserted"
               </span>
               <span class="crayon-h">
               </span>
               <span class="crayon-o">
                :
               </span>
               <span class="crayon-h">
               </span>
               <span class="crayon-cn">
                0
               </span>
               <span class="crayon-sy">
                ,
               </span>
              </div>
              <div class="crayon-line crayon-striped-line" id="crayon-5768647c9c58c483289647-6">
               <span class="crayon-h">
               </span>
               <span class="crayon-s">
                "nMatched"
               </span>
               <span class="crayon-h">
               </span>
               <span class="crayon-o">
                :
               </span>
               <span class="crayon-h">
               </span>
               <span class="crayon-cn">
                0
               </span>
               <span class="crayon-sy">
                ,
               </span>
              </div>
              <div class="crayon-line" id="crayon-5768647c9c58c483289647-7">
               <span class="crayon-h">
               </span>
               <span class="crayon-s">
                "nModified"
               </span>
               <span class="crayon-h">
               </span>
               <span class="crayon-o">
                :
               </span>
               <span class="crayon-h">
               </span>
               <span class="crayon-cn">
                0
               </span>
               <span class="crayon-sy">
                ,
               </span>
              </div>
              <div class="crayon-line crayon-striped-line" id="crayon-5768647c9c58c483289647-8">
               <span class="crayon-h">
               </span>
               <span class="crayon-s">
                "nRemoved"
               </span>
               <span class="crayon-h">
               </span>
               <span class="crayon-o">
                :
               </span>
               <span class="crayon-h">
               </span>
               <span class="crayon-cn">
                0
               </span>
               <span class="crayon-sy">
                ,
               </span>
              </div>
              <div class="crayon-line" id="crayon-5768647c9c58c483289647-9">
               <span class="crayon-h">
               </span>
               <span class="crayon-s">
                "upserted"
               </span>
               <span class="crayon-h">
               </span>
               <span class="crayon-o">
                :
               </span>
               <span class="crayon-h">
               </span>
               <span class="crayon-sy">
                [
               </span>
               <span class="crayon-h">
               </span>
               <span class="crayon-sy">
                ]
               </span>
              </div>
              <div class="crayon-line crayon-striped-line" id="crayon-5768647c9c58c483289647-10">
              </div>
             </div>
            </td>
           </tr>
          </tbody>
         </table>
        </div>
       </div>
       <!-- [Format Time: 0.0118 seconds] -->
       <p>
        表面我们成功地插入了两个数据。注意批量插入的格式是这样的：
        <code>
         db.movie.insert([{ITEM1},{ITEM2}])
        </code>
        。几部电影的外面需要用[]括起来。
       </p>
       <p>
        请注意，虽然collection的插入不需要先声明，但表达相同意思的key，名字要一样，比如，如果我们在一个文件里用
        <code>
         directed_by
        </code>
        来表示导演，则在其它文件也要保持同样的名字(而不是
        <code>
         director
        </code>
        之类的)。不同的名字不是不可以，技术上完全可行，但会给查询和更新带来困难。
       </p>
       <p>
        好了，到这里，我们就有了一个叫tutorial的数据库，里面有一个叫movie的集合，而movie里面有三个记录。接下来我们就可以对其进行查询了。
       </p>
       <h4>
        <a class="anchor" href="https://github.com/StevenSLXie/Tutorials-for-Web-Developers/blob/master/MongoDB%20%E6%9E%81%E7%AE%80%E5%AE%9E%E8%B7%B5%E5%85%A5%E9%97%A8.md#6-%E6%9F%A5%E8%AF%A2" id="user-content-6-查询">
        </a>
        6. 查询
       </h4>
       <p>
        在上一节我们已经接触到最简单的查询
        <code>
         db.movie.find().pretty()
        </code>
        。MongoDB支持各种各样的深度查询功能。先来一个最简单的例子，找出大卫芬奇(David Fincher)导演的所有电影：
       </p>
       <!-- Crayon Syntax Highlighter v_2.7.2_beta -->
       <div class="crayon-syntax crayon-theme-classic crayon-font-monaco crayon-os-pc print-yes notranslate" data-settings=" minimize scroll-mouseover" id="crayon-5768647c9c593628081069" style=" margin-top: 12px; margin-bottom: 12px; font-size: 12px !important; line-height: 15px !important;">
        <div class="crayon-toolbar" data-settings=" mouseover overlay hide delay" style="font-size: 12px !important;height: 18px !important; line-height: 18px !important;">
         <span class="crayon-title">
         </span>
         <div class="crayon-tools" style="font-size: 12px !important;height: 18px !important; line-height: 18px !important;">
          <div class="crayon-button crayon-nums-button" title="切换是否显示行编号">
           <div class="crayon-button-icon">
           </div>
          </div>
          <div class="crayon-button crayon-plain-button" title="纯文本显示代码">
           <div class="crayon-button-icon">
           </div>
          </div>
          <div class="crayon-button crayon-wrap-button" title="切换自动换行">
           <div class="crayon-button-icon">
           </div>
          </div>
          <div class="crayon-button crayon-expand-button" title="点击展开代码">
           <div class="crayon-button-icon">
           </div>
          </div>
          <div class="crayon-button crayon-copy-button" title="复制代码">
           <div class="crayon-button-icon">
           </div>
          </div>
          <div class="crayon-button crayon-popup-button" title="在新窗口中显示代码">
           <div class="crayon-button-icon">
           </div>
          </div>
         </div>
        </div>
        <div class="crayon-info" style="min-height: 16.8px !important; line-height: 16.8px !important;">
        </div>
        <div class="crayon-plain-wrap">
         <textarea class="crayon-plain print-no" data-settings="dblclick" readonly="" style="-moz-tab-size:4; -o-tab-size:4; -webkit-tab-size:4; tab-size:4; font-size: 12px !important; line-height: 15px !important;" wrap="soft">
          db.movie.find({'directed_by':'David Fincher'}).pretty()
         </textarea>
        </div>
        <div class="crayon-main" style="">
         <table class="crayon-table">
          <tbody>
           <tr class="crayon-row">
            <td class="crayon-nums " data-settings="show">
             <div class="crayon-nums-content" style="font-size: 12px !important; line-height: 15px !important;">
              <div class="crayon-num" data-line="crayon-5768647c9c593628081069-1">
               1
              </div>
              <div class="crayon-num crayon-striped-num" data-line="crayon-5768647c9c593628081069-2">
               2
              </div>
             </div>
            </td>
            <td class="crayon-code">
             <div class="crayon-pre" style="font-size: 12px !important; line-height: 15px !important; -moz-tab-size:4; -o-tab-size:4; -webkit-tab-size:4; tab-size:4;">
              <div class="crayon-line" id="crayon-5768647c9c593628081069-1">
               <span class="crayon-v">
                db
               </span>
               <span class="crayon-sy">
                .
               </span>
               <span class="crayon-v">
                movie
               </span>
               <span class="crayon-sy">
                .
               </span>
               <span class="crayon-e">
                find
               </span>
               <span class="crayon-sy">
                (
               </span>
               <span class="crayon-sy">
                {
               </span>
               <span class="crayon-s">
                'directed_by'
               </span>
               <span class="crayon-o">
                :
               </span>
               <span class="crayon-s">
                'David Fincher'
               </span>
               <span class="crayon-sy">
                }
               </span>
               <span class="crayon-sy">
                )
               </span>
               <span class="crayon-sy">
                .
               </span>
               <span class="crayon-e">
                pretty
               </span>
               <span class="crayon-sy">
                (
               </span>
               <span class="crayon-sy">
                )
               </span>
              </div>
              <div class="crayon-line crayon-striped-line" id="crayon-5768647c9c593628081069-2">
              </div>
             </div>
            </td>
           </tr>
          </tbody>
         </table>
        </div>
       </div>
       <!-- [Format Time: 0.0010 seconds] -->
       <p>
        将返回《搏击俱乐部》和《七宗罪》两部电影。这种搜索和SQL的
        <code>
         WHERE
        </code>
        语句是很相似的。
       </p>
       <p>
        也可以设置多个条件。比如找出大卫芬奇导演的, 摩根弗里曼主演的电影：
       </p>
       <!-- Crayon Syntax Highlighter v_2.7.2_beta -->
       <div class="crayon-syntax crayon-theme-classic crayon-font-monaco crayon-os-pc print-yes notranslate" data-settings=" minimize scroll-mouseover" id="crayon-5768647c9c599453626891" style=" margin-top: 12px; margin-bottom: 12px; font-size: 12px !important; line-height: 15px !important;">
        <div class="crayon-toolbar" data-settings=" mouseover overlay hide delay" style="font-size: 12px !important;height: 18px !important; line-height: 18px !important;">
         <span class="crayon-title">
         </span>
         <div class="crayon-tools" style="font-size: 12px !important;height: 18px !important; line-height: 18px !important;">
          <div class="crayon-button crayon-nums-button" title="切换是否显示行编号">
           <div class="crayon-button-icon">
           </div>
          </div>
          <div class="crayon-button crayon-plain-button" title="纯文本显示代码">
           <div class="crayon-button-icon">
           </div>
          </div>
          <div class="crayon-button crayon-wrap-button" title="切换自动换行">
           <div class="crayon-button-icon">
           </div>
          </div>
          <div class="crayon-button crayon-expand-button" title="点击展开代码">
           <div class="crayon-button-icon">
           </div>
          </div>
          <div class="crayon-button crayon-copy-button" title="复制代码">
           <div class="crayon-button-icon">
           </div>
          </div>
          <div class="crayon-button crayon-popup-button" title="在新窗口中显示代码">
           <div class="crayon-button-icon">
           </div>
          </div>
         </div>
        </div>
        <div class="crayon-info" style="min-height: 16.8px !important; line-height: 16.8px !important;">
        </div>
        <div class="crayon-plain-wrap">
         <textarea class="crayon-plain print-no" data-settings="dblclick" readonly="" style="-moz-tab-size:4; -o-tab-size:4; -webkit-tab-size:4; tab-size:4; font-size: 12px !important; line-height: 15px !important;" wrap="soft">
          db.movie.find({'directed_by':'David Fincher', 'stars':'Morgan Freeman'}).pretty()
         </textarea>
        </div>
        <div class="crayon-main" style="">
         <table class="crayon-table">
          <tbody>
           <tr class="crayon-row">
            <td class="crayon-nums " data-settings="show">
             <div class="crayon-nums-content" style="font-size: 12px !important; line-height: 15px !important;">
              <div class="crayon-num" data-line="crayon-5768647c9c599453626891-1">
               1
              </div>
              <div class="crayon-num crayon-striped-num" data-line="crayon-5768647c9c599453626891-2">
               2
              </div>
             </div>
            </td>
            <td class="crayon-code">
             <div class="crayon-pre" style="font-size: 12px !important; line-height: 15px !important; -moz-tab-size:4; -o-tab-size:4; -webkit-tab-size:4; tab-size:4;">
              <div class="crayon-line" id="crayon-5768647c9c599453626891-1">
               <span class="crayon-v">
                db
               </span>
               <span class="crayon-sy">
                .
               </span>
               <span class="crayon-v">
                movie
               </span>
               <span class="crayon-sy">
                .
               </span>
               <span class="crayon-e">
                find
               </span>
               <span class="crayon-sy">
                (
               </span>
               <span class="crayon-sy">
                {
               </span>
               <span class="crayon-s">
                'directed_by'
               </span>
               <span class="crayon-o">
                :
               </span>
               <span class="crayon-s">
                'David Fincher'
               </span>
               <span class="crayon-sy">
                ,
               </span>
               <span class="crayon-h">
               </span>
               <span class="crayon-s">
                'stars'
               </span>
               <span class="crayon-o">
                :
               </span>
               <span class="crayon-s">
                'Morgan Freeman'
               </span>
               <span class="crayon-sy">
                }
               </span>
               <span class="crayon-sy">
                )
               </span>
               <span class="crayon-sy">
                .
               </span>
               <span class="crayon-e">
                pretty
               </span>
               <span class="crayon-sy">
                (
               </span>
               <span class="crayon-sy">
                )
               </span>
              </div>
              <div class="crayon-line crayon-striped-line" id="crayon-5768647c9c599453626891-2">
              </div>
             </div>
            </td>
           </tr>
          </tbody>
         </table>
        </div>
       </div>
       <!-- [Format Time: 0.0012 seconds] -->
       <p>
        这里两个条件之间，是AND的关系，只有同时满足两个条件的电影才会被输出。同理，可以设置多个的条件，不赘述。
       </p>
       <p>
        条件之间也可以是或的关系，比如找出罗宾怀特或摩根弗里曼主演的电影：
       </p>
       <!-- Crayon Syntax Highlighter v_2.7.2_beta -->
       <div class="crayon-syntax crayon-theme-classic crayon-font-monaco crayon-os-pc print-yes notranslate" data-settings=" minimize scroll-mouseover" id="crayon-5768647c9c59f964833451" style=" margin-top: 12px; margin-bottom: 12px; font-size: 12px !important; line-height: 15px !important;">
        <div class="crayon-toolbar" data-settings=" mouseover overlay hide delay" style="font-size: 12px !important;height: 18px !important; line-height: 18px !important;">
         <span class="crayon-title">
         </span>
         <div class="crayon-tools" style="font-size: 12px !important;height: 18px !important; line-height: 18px !important;">
          <div class="crayon-button crayon-nums-button" title="切换是否显示行编号">
           <div class="crayon-button-icon">
           </div>
          </div>
          <div class="crayon-button crayon-plain-button" title="纯文本显示代码">
           <div class="crayon-button-icon">
           </div>
          </div>
          <div class="crayon-button crayon-wrap-button" title="切换自动换行">
           <div class="crayon-button-icon">
           </div>
          </div>
          <div class="crayon-button crayon-expand-button" title="点击展开代码">
           <div class="crayon-button-icon">
           </div>
          </div>
          <div class="crayon-button crayon-copy-button" title="复制代码">
           <div class="crayon-button-icon">
           </div>
          </div>
          <div class="crayon-button crayon-popup-button" title="在新窗口中显示代码">
           <div class="crayon-button-icon">
           </div>
          </div>
         </div>
        </div>
        <div class="crayon-info" style="min-height: 16.8px !important; line-height: 16.8px !important;">
        </div>
        <div class="crayon-plain-wrap">
         <textarea class="crayon-plain print-no" data-settings="dblclick" readonly="" style="-moz-tab-size:4; -o-tab-size:4; -webkit-tab-size:4; tab-size:4; font-size: 12px !important; line-height: 15px !important;" wrap="soft">
          db.movie.find(
{
  $or: 
     [  {'stars':'Robin Wright'}, 
        {'stars':'Morgan Freeman'}
     ]
}).pretty()
         </textarea>
        </div>
        <div class="crayon-main" style="">
         <table class="crayon-table">
          <tbody>
           <tr class="crayon-row">
            <td class="crayon-nums " data-settings="show">
             <div class="crayon-nums-content" style="font-size: 12px !important; line-height: 15px !important;">
              <div class="crayon-num" data-line="crayon-5768647c9c59f964833451-1">
               1
              </div>
              <div class="crayon-num crayon-striped-num" data-line="crayon-5768647c9c59f964833451-2">
               2
              </div>
              <div class="crayon-num" data-line="crayon-5768647c9c59f964833451-3">
               3
              </div>
              <div class="crayon-num crayon-striped-num" data-line="crayon-5768647c9c59f964833451-4">
               4
              </div>
              <div class="crayon-num" data-line="crayon-5768647c9c59f964833451-5">
               5
              </div>
              <div class="crayon-num crayon-striped-num" data-line="crayon-5768647c9c59f964833451-6">
               6
              </div>
              <div class="crayon-num" data-line="crayon-5768647c9c59f964833451-7">
               7
              </div>
              <div class="crayon-num crayon-striped-num" data-line="crayon-5768647c9c59f964833451-8">
               8
              </div>
             </div>
            </td>
            <td class="crayon-code">
             <div class="crayon-pre" style="font-size: 12px !important; line-height: 15px !important; -moz-tab-size:4; -o-tab-size:4; -webkit-tab-size:4; tab-size:4;">
              <div class="crayon-line" id="crayon-5768647c9c59f964833451-1">
               <span class="crayon-v">
                db
               </span>
               <span class="crayon-sy">
                .
               </span>
               <span class="crayon-v">
                movie
               </span>
               <span class="crayon-sy">
                .
               </span>
               <span class="crayon-e">
                find
               </span>
               <span class="crayon-sy">
                (
               </span>
              </div>
              <div class="crayon-line crayon-striped-line" id="crayon-5768647c9c59f964833451-2">
               <span class="crayon-sy">
                {
               </span>
              </div>
              <div class="crayon-line" id="crayon-5768647c9c59f964833451-3">
               <span class="crayon-h">
               </span>
               <span class="crayon-sy">
                $
               </span>
               <span class="crayon-st">
                or
               </span>
               <span class="crayon-o">
                :
               </span>
               <span class="crayon-h">
               </span>
              </div>
              <div class="crayon-line crayon-striped-line" id="crayon-5768647c9c59f964833451-4">
               <span class="crayon-h">
               </span>
               <span class="crayon-sy">
                [
               </span>
               <span class="crayon-h">
               </span>
               <span class="crayon-sy">
                {
               </span>
               <span class="crayon-s">
                'stars'
               </span>
               <span class="crayon-o">
                :
               </span>
               <span class="crayon-s">
                'Robin Wright'
               </span>
               <span class="crayon-sy">
                }
               </span>
               <span class="crayon-sy">
                ,
               </span>
               <span class="crayon-h">
               </span>
              </div>
              <div class="crayon-line" id="crayon-5768647c9c59f964833451-5">
               <span class="crayon-h">
               </span>
               <span class="crayon-sy">
                {
               </span>
               <span class="crayon-s">
                'stars'
               </span>
               <span class="crayon-o">
                :
               </span>
               <span class="crayon-s">
                'Morgan Freeman'
               </span>
               <span class="crayon-sy">
                }
               </span>
              </div>
              <div class="crayon-line crayon-striped-line" id="crayon-5768647c9c59f964833451-6">
               <span class="crayon-h">
               </span>
               <span class="crayon-sy">
                ]
               </span>
              </div>
              <div class="crayon-line" id="crayon-5768647c9c59f964833451-7">
               <span class="crayon-sy">
                }
               </span>
               <span class="crayon-sy">
                )
               </span>
               <span class="crayon-sy">
                .
               </span>
               <span class="crayon-e">
                pretty
               </span>
               <span class="crayon-sy">
                (
               </span>
               <span class="crayon-sy">
                )
               </span>
              </div>
              <div class="crayon-line crayon-striped-line" id="crayon-5768647c9c59f964833451-8">
              </div>
             </div>
            </td>
           </tr>
          </tbody>
         </table>
        </div>
       </div>
       <!-- [Format Time: 0.0018 seconds] -->
       <p>
        注意这里面稍显复杂的各种括号。
       </p>
       <p>
        还可以设置一个范围的搜索，比如找出50万人以上赞的电影：
       </p>
       <!-- Crayon Syntax Highlighter v_2.7.2_beta -->
       <div class="crayon-syntax crayon-theme-classic crayon-font-monaco crayon-os-pc print-yes notranslate" data-settings=" minimize scroll-mouseover" id="crayon-5768647c9c5a5594349539" style=" margin-top: 12px; margin-bottom: 12px; font-size: 12px !important; line-height: 15px !important;">
        <div class="crayon-toolbar" data-settings=" mouseover overlay hide delay" style="font-size: 12px !important;height: 18px !important; line-height: 18px !important;">
         <span class="crayon-title">
         </span>
         <div class="crayon-tools" style="font-size: 12px !important;height: 18px !important; line-height: 18px !important;">
          <div class="crayon-button crayon-nums-button" title="切换是否显示行编号">
           <div class="crayon-button-icon">
           </div>
          </div>
          <div class="crayon-button crayon-plain-button" title="纯文本显示代码">
           <div class="crayon-button-icon">
           </div>
          </div>
          <div class="crayon-button crayon-wrap-button" title="切换自动换行">
           <div class="crayon-button-icon">
           </div>
          </div>
          <div class="crayon-button crayon-expand-button" title="点击展开代码">
           <div class="crayon-button-icon">
           </div>
          </div>
          <div class="crayon-button crayon-copy-button" title="复制代码">
           <div class="crayon-button-icon">
           </div>
          </div>
          <div class="crayon-button crayon-popup-button" title="在新窗口中显示代码">
           <div class="crayon-button-icon">
           </div>
          </div>
         </div>
        </div>
        <div class="crayon-info" style="min-height: 16.8px !important; line-height: 16.8px !important;">
        </div>
        <div class="crayon-plain-wrap">
         <textarea class="crayon-plain print-no" data-settings="dblclick" readonly="" style="-moz-tab-size:4; -o-tab-size:4; -webkit-tab-size:4; tab-size:4; font-size: 12px !important; line-height: 15px !important;" wrap="soft">
          db.movie.find({'likes':{$gt:500000}}).pretty()
         </textarea>
        </div>
        <div class="crayon-main" style="">
         <table class="crayon-table">
          <tbody>
           <tr class="crayon-row">
            <td class="crayon-nums " data-settings="show">
             <div class="crayon-nums-content" style="font-size: 12px !important; line-height: 15px !important;">
              <div class="crayon-num" data-line="crayon-5768647c9c5a5594349539-1">
               1
              </div>
              <div class="crayon-num crayon-striped-num" data-line="crayon-5768647c9c5a5594349539-2">
               2
              </div>
             </div>
            </td>
            <td class="crayon-code">
             <div class="crayon-pre" style="font-size: 12px !important; line-height: 15px !important; -moz-tab-size:4; -o-tab-size:4; -webkit-tab-size:4; tab-size:4;">
              <div class="crayon-line" id="crayon-5768647c9c5a5594349539-1">
               <span class="crayon-v">
                db
               </span>
               <span class="crayon-sy">
                .
               </span>
               <span class="crayon-v">
                movie
               </span>
               <span class="crayon-sy">
                .
               </span>
               <span class="crayon-e">
                find
               </span>
               <span class="crayon-sy">
                (
               </span>
               <span class="crayon-sy">
                {
               </span>
               <span class="crayon-s">
                'likes'
               </span>
               <span class="crayon-o">
                :
               </span>
               <span class="crayon-sy">
                {
               </span>
               <span class="crayon-sy">
                $
               </span>
               <span class="crayon-v">
                gt
               </span>
               <span class="crayon-o">
                :
               </span>
               <span class="crayon-cn">
                500000
               </span>
               <span class="crayon-sy">
                }
               </span>
               <span class="crayon-sy">
                }
               </span>
               <span class="crayon-sy">
                )
               </span>
               <span class="crayon-sy">
                .
               </span>
               <span class="crayon-e">
                pretty
               </span>
               <span class="crayon-sy">
                (
               </span>
               <span class="crayon-sy">
                )
               </span>
              </div>
              <div class="crayon-line crayon-striped-line" id="crayon-5768647c9c5a5594349539-2">
              </div>
             </div>
            </td>
           </tr>
          </tbody>
         </table>
        </div>
       </div>
       <!-- [Format Time: 0.0013 seconds] -->
       <p>
        同样要注意略复杂的括号。注意，在这些查询里，key的单引号都是可选的，也就是说，上述语句也可以写成：
       </p>
       <!-- Crayon Syntax Highlighter v_2.7.2_beta -->
       <div class="crayon-syntax crayon-theme-classic crayon-font-monaco crayon-os-pc print-yes notranslate" data-settings=" minimize scroll-mouseover" id="crayon-5768647c9c5aa458079969" style=" margin-top: 12px; margin-bottom: 12px; font-size: 12px !important; line-height: 15px !important;">
        <div class="crayon-toolbar" data-settings=" mouseover overlay hide delay" style="font-size: 12px !important;height: 18px !important; line-height: 18px !important;">
         <span class="crayon-title">
         </span>
         <div class="crayon-tools" style="font-size: 12px !important;height: 18px !important; line-height: 18px !important;">
          <div class="crayon-button crayon-nums-button" title="切换是否显示行编号">
           <div class="crayon-button-icon">
           </div>
          </div>
          <div class="crayon-button crayon-plain-button" title="纯文本显示代码">
           <div class="crayon-button-icon">
           </div>
          </div>
          <div class="crayon-button crayon-wrap-button" title="切换自动换行">
           <div class="crayon-button-icon">
           </div>
          </div>
          <div class="crayon-button crayon-expand-button" title="点击展开代码">
           <div class="crayon-button-icon">
           </div>
          </div>
          <div class="crayon-button crayon-copy-button" title="复制代码">
           <div class="crayon-button-icon">
           </div>
          </div>
          <div class="crayon-button crayon-popup-button" title="在新窗口中显示代码">
           <div class="crayon-button-icon">
           </div>
          </div>
         </div>
        </div>
        <div class="crayon-info" style="min-height: 16.8px !important; line-height: 16.8px !important;">
        </div>
        <div class="crayon-plain-wrap">
         <textarea class="crayon-plain print-no" data-settings="dblclick" readonly="" style="-moz-tab-size:4; -o-tab-size:4; -webkit-tab-size:4; tab-size:4; font-size: 12px !important; line-height: 15px !important;" wrap="soft">
          db.movie.find({likes:{$gt:500000}}).pretty()
         </textarea>
        </div>
        <div class="crayon-main" style="">
         <table class="crayon-table">
          <tbody>
           <tr class="crayon-row">
            <td class="crayon-nums " data-settings="show">
             <div class="crayon-nums-content" style="font-size: 12px !important; line-height: 15px !important;">
              <div class="crayon-num" data-line="crayon-5768647c9c5aa458079969-1">
               1
              </div>
              <div class="crayon-num crayon-striped-num" data-line="crayon-5768647c9c5aa458079969-2">
               2
              </div>
             </div>
            </td>
            <td class="crayon-code">
             <div class="crayon-pre" style="font-size: 12px !important; line-height: 15px !important; -moz-tab-size:4; -o-tab-size:4; -webkit-tab-size:4; tab-size:4;">
              <div class="crayon-line" id="crayon-5768647c9c5aa458079969-1">
               <span class="crayon-v">
                db
               </span>
               <span class="crayon-sy">
                .
               </span>
               <span class="crayon-v">
                movie
               </span>
               <span class="crayon-sy">
                .
               </span>
               <span class="crayon-e">
                find
               </span>
               <span class="crayon-sy">
                (
               </span>
               <span class="crayon-sy">
                {
               </span>
               <span class="crayon-v">
                likes
               </span>
               <span class="crayon-o">
                :
               </span>
               <span class="crayon-sy">
                {
               </span>
               <span class="crayon-sy">
                $
               </span>
               <span class="crayon-v">
                gt
               </span>
               <span class="crayon-o">
                :
               </span>
               <span class="crayon-cn">
                500000
               </span>
               <span class="crayon-sy">
                }
               </span>
               <span class="crayon-sy">
                }
               </span>
               <span class="crayon-sy">
                )
               </span>
               <span class="crayon-sy">
                .
               </span>
               <span class="crayon-e">
                pretty
               </span>
               <span class="crayon-sy">
                (
               </span>
               <span class="crayon-sy">
                )
               </span>
              </div>
              <div class="crayon-line crayon-striped-line" id="crayon-5768647c9c5aa458079969-2">
              </div>
             </div>
            </td>
           </tr>
          </tbody>
         </table>
        </div>
       </div>
       <!-- [Format Time: 0.0015 seconds] -->
       <p>
        类似地，少于二十万人赞的电影：
       </p>
       <!-- Crayon Syntax Highlighter v_2.7.2_beta -->
       <div class="crayon-syntax crayon-theme-classic crayon-font-monaco crayon-os-pc print-yes notranslate" data-settings=" minimize scroll-mouseover" id="crayon-5768647c9c5b0003560520" style=" margin-top: 12px; margin-bottom: 12px; font-size: 12px !important; line-height: 15px !important;">
        <div class="crayon-toolbar" data-settings=" mouseover overlay hide delay" style="font-size: 12px !important;height: 18px !important; line-height: 18px !important;">
         <span class="crayon-title">
         </span>
         <div class="crayon-tools" style="font-size: 12px !important;height: 18px !important; line-height: 18px !important;">
          <div class="crayon-button crayon-nums-button" title="切换是否显示行编号">
           <div class="crayon-button-icon">
           </div>
          </div>
          <div class="crayon-button crayon-plain-button" title="纯文本显示代码">
           <div class="crayon-button-icon">
           </div>
          </div>
          <div class="crayon-button crayon-wrap-button" title="切换自动换行">
           <div class="crayon-button-icon">
           </div>
          </div>
          <div class="crayon-button crayon-expand-button" title="点击展开代码">
           <div class="crayon-button-icon">
           </div>
          </div>
          <div class="crayon-button crayon-copy-button" title="复制代码">
           <div class="crayon-button-icon">
           </div>
          </div>
          <div class="crayon-button crayon-popup-button" title="在新窗口中显示代码">
           <div class="crayon-button-icon">
           </div>
          </div>
         </div>
        </div>
        <div class="crayon-info" style="min-height: 16.8px !important; line-height: 16.8px !important;">
        </div>
        <div class="crayon-plain-wrap">
         <textarea class="crayon-plain print-no" data-settings="dblclick" readonly="" style="-moz-tab-size:4; -o-tab-size:4; -webkit-tab-size:4; tab-size:4; font-size: 12px !important; line-height: 15px !important;" wrap="soft">
          db.movie.find({likes:{$lt:200000}}).pretty()
         </textarea>
        </div>
        <div class="crayon-main" style="">
         <table class="crayon-table">
          <tbody>
           <tr class="crayon-row">
            <td class="crayon-nums " data-settings="show">
             <div class="crayon-nums-content" style="font-size: 12px !important; line-height: 15px !important;">
              <div class="crayon-num" data-line="crayon-5768647c9c5b0003560520-1">
               1
              </div>
              <div class="crayon-num crayon-striped-num" data-line="crayon-5768647c9c5b0003560520-2">
               2
              </div>
             </div>
            </td>
            <td class="crayon-code">
             <div class="crayon-pre" style="font-size: 12px !important; line-height: 15px !important; -moz-tab-size:4; -o-tab-size:4; -webkit-tab-size:4; tab-size:4;">
              <div class="crayon-line" id="crayon-5768647c9c5b0003560520-1">
               <span class="crayon-v">
                db
               </span>
               <span class="crayon-sy">
                .
               </span>
               <span class="crayon-v">
                movie
               </span>
               <span class="crayon-sy">
                .
               </span>
               <span class="crayon-e">
                find
               </span>
               <span class="crayon-sy">
                (
               </span>
               <span class="crayon-sy">
                {
               </span>
               <span class="crayon-v">
                likes
               </span>
               <span class="crayon-o">
                :
               </span>
               <span class="crayon-sy">
                {
               </span>
               <span class="crayon-sy">
                $
               </span>
               <span class="crayon-v">
                lt
               </span>
               <span class="crayon-o">
                :
               </span>
               <span class="crayon-cn">
                200000
               </span>
               <span class="crayon-sy">
                }
               </span>
               <span class="crayon-sy">
                }
               </span>
               <span class="crayon-sy">
                )
               </span>
               <span class="crayon-sy">
                .
               </span>
               <span class="crayon-e">
                pretty
               </span>
               <span class="crayon-sy">
                (
               </span>
               <span class="crayon-sy">
                )
               </span>
              </div>
              <div class="crayon-line crayon-striped-line" id="crayon-5768647c9c5b0003560520-2">
              </div>
             </div>
            </td>
           </tr>
          </tbody>
         </table>
        </div>
       </div>
       <!-- [Format Time: 0.0012 seconds] -->
       <p>
        类似的运算符还有：
        <code>
         $let
        </code>
        :小于或等于；
        <code>
         $get
        </code>
        :大于或等于；
        <code>
         $ne
        </code>
        :不等于。
       </p>
       <p>
        注意，对于包含多个值的key，同样可以用find来查询。比如：
       </p>
       <!-- Crayon Syntax Highlighter v_2.7.2_beta -->
       <div class="crayon-syntax crayon-theme-classic crayon-font-monaco crayon-os-pc print-yes notranslate" data-settings=" minimize scroll-mouseover" id="crayon-5768647c9c5b6111132405" style=" margin-top: 12px; margin-bottom: 12px; font-size: 12px !important; line-height: 15px !important;">
        <div class="crayon-toolbar" data-settings=" mouseover overlay hide delay" style="font-size: 12px !important;height: 18px !important; line-height: 18px !important;">
         <span class="crayon-title">
         </span>
         <div class="crayon-tools" style="font-size: 12px !important;height: 18px !important; line-height: 18px !important;">
          <div class="crayon-button crayon-nums-button" title="切换是否显示行编号">
           <div class="crayon-button-icon">
           </div>
          </div>
          <div class="crayon-button crayon-plain-button" title="纯文本显示代码">
           <div class="crayon-button-icon">
           </div>
          </div>
          <div class="crayon-button crayon-wrap-button" title="切换自动换行">
           <div class="crayon-button-icon">
           </div>
          </div>
          <div class="crayon-button crayon-expand-button" title="点击展开代码">
           <div class="crayon-button-icon">
           </div>
          </div>
          <div class="crayon-button crayon-copy-button" title="复制代码">
           <div class="crayon-button-icon">
           </div>
          </div>
          <div class="crayon-button crayon-popup-button" title="在新窗口中显示代码">
           <div class="crayon-button-icon">
           </div>
          </div>
         </div>
        </div>
        <div class="crayon-info" style="min-height: 16.8px !important; line-height: 16.8px !important;">
        </div>
        <div class="crayon-plain-wrap">
         <textarea class="crayon-plain print-no" data-settings="dblclick" readonly="" style="-moz-tab-size:4; -o-tab-size:4; -webkit-tab-size:4; tab-size:4; font-size: 12px !important; line-height: 15px !important;" wrap="soft">
          db.movie.find({'tags':'romance'})
         </textarea>
        </div>
        <div class="crayon-main" style="">
         <table class="crayon-table">
          <tbody>
           <tr class="crayon-row">
            <td class="crayon-nums " data-settings="show">
             <div class="crayon-nums-content" style="font-size: 12px !important; line-height: 15px !important;">
              <div class="crayon-num" data-line="crayon-5768647c9c5b6111132405-1">
               1
              </div>
              <div class="crayon-num crayon-striped-num" data-line="crayon-5768647c9c5b6111132405-2">
               2
              </div>
             </div>
            </td>
            <td class="crayon-code">
             <div class="crayon-pre" style="font-size: 12px !important; line-height: 15px !important; -moz-tab-size:4; -o-tab-size:4; -webkit-tab-size:4; tab-size:4;">
              <div class="crayon-line" id="crayon-5768647c9c5b6111132405-1">
               <span class="crayon-v">
                db
               </span>
               <span class="crayon-sy">
                .
               </span>
               <span class="crayon-v">
                movie
               </span>
               <span class="crayon-sy">
                .
               </span>
               <span class="crayon-e">
                find
               </span>
               <span class="crayon-sy">
                (
               </span>
               <span class="crayon-sy">
                {
               </span>
               <span class="crayon-s">
                'tags'
               </span>
               <span class="crayon-o">
                :
               </span>
               <span class="crayon-s">
                'romance'
               </span>
               <span class="crayon-sy">
                }
               </span>
               <span class="crayon-sy">
                )
               </span>
              </div>
              <div class="crayon-line crayon-striped-line" id="crayon-5768647c9c5b6111132405-2">
              </div>
             </div>
            </td>
           </tr>
          </tbody>
         </table>
        </div>
       </div>
       <!-- [Format Time: 0.0009 seconds] -->
       <p>
        将返回《阿甘正传》，虽然其标签既有romance，又有drama，但只要符合一个就可以了。
       </p>
       <p>
        如果你确切地知道返回的结果只有一个，也可以用
        <code>
         findOne
        </code>
        :
       </p>
       <!-- Crayon Syntax Highlighter v_2.7.2_beta -->
       <div class="crayon-syntax crayon-theme-classic crayon-font-monaco crayon-os-pc print-yes notranslate" data-settings=" minimize scroll-mouseover" id="crayon-5768647c9c5bb609066093" style=" margin-top: 12px; margin-bottom: 12px; font-size: 12px !important; line-height: 15px !important;">
        <div class="crayon-toolbar" data-settings=" mouseover overlay hide delay" style="font-size: 12px !important;height: 18px !important; line-height: 18px !important;">
         <span class="crayon-title">
         </span>
         <div class="crayon-tools" style="font-size: 12px !important;height: 18px !important; line-height: 18px !important;">
          <div class="crayon-button crayon-nums-button" title="切换是否显示行编号">
           <div class="crayon-button-icon">
           </div>
          </div>
          <div class="crayon-button crayon-plain-button" title="纯文本显示代码">
           <div class="crayon-button-icon">
           </div>
          </div>
          <div class="crayon-button crayon-wrap-button" title="切换自动换行">
           <div class="crayon-button-icon">
           </div>
          </div>
          <div class="crayon-button crayon-expand-button" title="点击展开代码">
           <div class="crayon-button-icon">
           </div>
          </div>
          <div class="crayon-button crayon-copy-button" title="复制代码">
           <div class="crayon-button-icon">
           </div>
          </div>
          <div class="crayon-button crayon-popup-button" title="在新窗口中显示代码">
           <div class="crayon-button-icon">
           </div>
          </div>
         </div>
        </div>
        <div class="crayon-info" style="min-height: 16.8px !important; line-height: 16.8px !important;">
        </div>
        <div class="crayon-plain-wrap">
         <textarea class="crayon-plain print-no" data-settings="dblclick" readonly="" style="-moz-tab-size:4; -o-tab-size:4; -webkit-tab-size:4; tab-size:4; font-size: 12px !important; line-height: 15px !important;" wrap="soft">
          db.movie.findOne({'title':'Forrest Gump'})
         </textarea>
        </div>
        <div class="crayon-main" style="">
         <table class="crayon-table">
          <tbody>
           <tr class="crayon-row">
            <td class="crayon-nums " data-settings="show">
             <div class="crayon-nums-content" style="font-size: 12px !important; line-height: 15px !important;">
              <div class="crayon-num" data-line="crayon-5768647c9c5bb609066093-1">
               1
              </div>
              <div class="crayon-num crayon-striped-num" data-line="crayon-5768647c9c5bb609066093-2">
               2
              </div>
             </div>
            </td>
            <td class="crayon-code">
             <div class="crayon-pre" style="font-size: 12px !important; line-height: 15px !important; -moz-tab-size:4; -o-tab-size:4; -webkit-tab-size:4; tab-size:4;">
              <div class="crayon-line" id="crayon-5768647c9c5bb609066093-1">
               <span class="crayon-v">
                db
               </span>
               <span class="crayon-sy">
                .
               </span>
               <span class="crayon-v">
                movie
               </span>
               <span class="crayon-sy">
                .
               </span>
               <span class="crayon-e">
                findOne
               </span>
               <span class="crayon-sy">
                (
               </span>
               <span class="crayon-sy">
                {
               </span>
               <span class="crayon-s">
                'title'
               </span>
               <span class="crayon-o">
                :
               </span>
               <span class="crayon-s">
                'Forrest Gump'
               </span>
               <span class="crayon-sy">
                }
               </span>
               <span class="crayon-sy">
                )
               </span>
              </div>
              <div class="crayon-line crayon-striped-line" id="crayon-5768647c9c5bb609066093-2">
              </div>
             </div>
            </td>
           </tr>
          </tbody>
         </table>
        </div>
       </div>
       <!-- [Format Time: 0.0009 seconds] -->
       <p>
        如果有多个结果，则会按磁盘存储顺序返回第一个。请注意，
        <code>
         findOne()
        </code>
        自带pretty模式，所以不能再加
        <code>
         pretty()
        </code>
        ，将报错。
       </p>
       <p>
        如果结果很多而你只想显示其中一部分，可以用
        <code>
         limit()
        </code>
        和
        <code>
         skip()
        </code>
        ，前者指明输出的个数，后者指明从第二个结果开始数。比如：
       </p>
       <!-- Crayon Syntax Highlighter v_2.7.2_beta -->
       <div class="crayon-syntax crayon-theme-classic crayon-font-monaco crayon-os-pc print-yes notranslate" data-settings=" minimize scroll-mouseover" id="crayon-5768647c9c5c1956837757" style=" margin-top: 12px; margin-bottom: 12px; font-size: 12px !important; line-height: 15px !important;">
        <div class="crayon-toolbar" data-settings=" mouseover overlay hide delay" style="font-size: 12px !important;height: 18px !important; line-height: 18px !important;">
         <span class="crayon-title">
         </span>
         <div class="crayon-tools" style="font-size: 12px !important;height: 18px !important; line-height: 18px !important;">
          <div class="crayon-button crayon-nums-button" title="切换是否显示行编号">
           <div class="crayon-button-icon">
           </div>
          </div>
          <div class="crayon-button crayon-plain-button" title="纯文本显示代码">
           <div class="crayon-button-icon">
           </div>
          </div>
          <div class="crayon-button crayon-wrap-button" title="切换自动换行">
           <div class="crayon-button-icon">
           </div>
          </div>
          <div class="crayon-button crayon-expand-button" title="点击展开代码">
           <div class="crayon-button-icon">
           </div>
          </div>
          <div class="crayon-button crayon-copy-button" title="复制代码">
           <div class="crayon-button-icon">
           </div>
          </div>
          <div class="crayon-button crayon-popup-button" title="在新窗口中显示代码">
           <div class="crayon-button-icon">
           </div>
          </div>
         </div>
        </div>
        <div class="crayon-info" style="min-height: 16.8px !important; line-height: 16.8px !important;">
        </div>
        <div class="crayon-plain-wrap">
         <textarea class="crayon-plain print-no" data-settings="dblclick" readonly="" style="-moz-tab-size:4; -o-tab-size:4; -webkit-tab-size:4; tab-size:4; font-size: 12px !important; line-height: 15px !important;" wrap="soft">
          db.movie.find().limit(2).skip(1).pretty()
         </textarea>
        </div>
        <div class="crayon-main" style="">
         <table class="crayon-table">
          <tbody>
           <tr class="crayon-row">
            <td class="crayon-nums " data-settings="show">
             <div class="crayon-nums-content" style="font-size: 12px !important; line-height: 15px !important;">
              <div class="crayon-num" data-line="crayon-5768647c9c5c1956837757-1">
               1
              </div>
              <div class="crayon-num crayon-striped-num" data-line="crayon-5768647c9c5c1956837757-2">
               2
              </div>
             </div>
            </td>
            <td class="crayon-code">
             <div class="crayon-pre" style="font-size: 12px !important; line-height: 15px !important; -moz-tab-size:4; -o-tab-size:4; -webkit-tab-size:4; tab-size:4;">
              <div class="crayon-line" id="crayon-5768647c9c5c1956837757-1">
               <span class="crayon-v">
                db
               </span>
               <span class="crayon-sy">
                .
               </span>
               <span class="crayon-v">
                movie
               </span>
               <span class="crayon-sy">
                .
               </span>
               <span class="crayon-e">
                find
               </span>
               <span class="crayon-sy">
                (
               </span>
               <span class="crayon-sy">
                )
               </span>
               <span class="crayon-sy">
                .
               </span>
               <span class="crayon-e">
                limit
               </span>
               <span class="crayon-sy">
                (
               </span>
               <span class="crayon-cn">
                2
               </span>
               <span class="crayon-sy">
                )
               </span>
               <span class="crayon-sy">
                .
               </span>
               <span class="crayon-e">
                skip
               </span>
               <span class="crayon-sy">
                (
               </span>
               <span class="crayon-cn">
                1
               </span>
               <span class="crayon-sy">
                )
               </span>
               <span class="crayon-sy">
                .
               </span>
               <span class="crayon-e">
                pretty
               </span>
               <span class="crayon-sy">
                (
               </span>
               <span class="crayon-sy">
                )
               </span>
              </div>
              <div class="crayon-line crayon-striped-line" id="crayon-5768647c9c5c1956837757-2">
              </div>
             </div>
            </td>
           </tr>
          </tbody>
         </table>
        </div>
       </div>
       <!-- [Format Time: 0.0012 seconds] -->
       <p>
        则跳过第一部，从第二部开始选取两部电影。
       </p>
       <h4>
        <a class="anchor" href="https://github.com/StevenSLXie/Tutorials-for-Web-Developers/blob/master/MongoDB%20%E6%9E%81%E7%AE%80%E5%AE%9E%E8%B7%B5%E5%85%A5%E9%97%A8.md#7-%E5%B1%80%E9%83%A8%E6%9F%A5%E8%AF%A2" id="user-content-7-局部查询">
        </a>
        7. 局部查询
       </h4>
       <p>
        第五节的时候我们讲了
        <code>
         find
        </code>
        的用法，但对于符合条件的条目，我们都是返回整个JSON文件的。这类似于SQL里面的
        <code>
         SELECT *
        </code>
        。有的时候，我们需要的，仅仅是部分数据，这个时候，
        <code>
         find
        </code>
        的局部查询的功能就派上用场了。先来看一个例子，返回tags为drama的电影的名字和首映日期。
       </p>
       <!-- Crayon Syntax Highlighter v_2.7.2_beta -->
       <div class="crayon-syntax crayon-theme-classic crayon-font-monaco crayon-os-pc print-yes notranslate" data-settings=" minimize scroll-mouseover" id="crayon-5768647c9c5c7221372851" style=" margin-top: 12px; margin-bottom: 12px; font-size: 12px !important; line-height: 15px !important;">
        <div class="crayon-toolbar" data-settings=" mouseover overlay hide delay" style="font-size: 12px !important;height: 18px !important; line-height: 18px !important;">
         <span class="crayon-title">
         </span>
         <div class="crayon-tools" style="font-size: 12px !important;height: 18px !important; line-height: 18px !important;">
          <div class="crayon-button crayon-nums-button" title="切换是否显示行编号">
           <div class="crayon-button-icon">
           </div>
          </div>
          <div class="crayon-button crayon-plain-button" title="纯文本显示代码">
           <div class="crayon-button-icon">
           </div>
          </div>
          <div class="crayon-button crayon-wrap-button" title="切换自动换行">
           <div class="crayon-button-icon">
           </div>
          </div>
          <div class="crayon-button crayon-expand-button" title="点击展开代码">
           <div class="crayon-button-icon">
           </div>
          </div>
          <div class="crayon-button crayon-copy-button" title="复制代码">
           <div class="crayon-button-icon">
           </div>
          </div>
          <div class="crayon-button crayon-popup-button" title="在新窗口中显示代码">
           <div class="crayon-button-icon">
           </div>
          </div>
         </div>
        </div>
        <div class="crayon-info" style="min-height: 16.8px !important; line-height: 16.8px !important;">
        </div>
        <div class="crayon-plain-wrap">
         <textarea class="crayon-plain print-no" data-settings="dblclick" readonly="" style="-moz-tab-size:4; -o-tab-size:4; -webkit-tab-size:4; tab-size:4; font-size: 12px !important; line-height: 15px !important;" wrap="soft">
          db.movie.find({'tags':'drama'},{'debut':1,'title':1}).pretty()
         </textarea>
        </div>
        <div class="crayon-main" style="">
         <table class="crayon-table">
          <tbody>
           <tr class="crayon-row">
            <td class="crayon-nums " data-settings="show">
             <div class="crayon-nums-content" style="font-size: 12px !important; line-height: 15px !important;">
              <div class="crayon-num" data-line="crayon-5768647c9c5c7221372851-1">
               1
              </div>
              <div class="crayon-num crayon-striped-num" data-line="crayon-5768647c9c5c7221372851-2">
               2
              </div>
             </div>
            </td>
            <td class="crayon-code">
             <div class="crayon-pre" style="font-size: 12px !important; line-height: 15px !important; -moz-tab-size:4; -o-tab-size:4; -webkit-tab-size:4; tab-size:4;">
              <div class="crayon-line" id="crayon-5768647c9c5c7221372851-1">
               <span class="crayon-v">
                db
               </span>
               <span class="crayon-sy">
                .
               </span>
               <span class="crayon-v">
                movie
               </span>
               <span class="crayon-sy">
                .
               </span>
               <span class="crayon-e">
                find
               </span>
               <span class="crayon-sy">
                (
               </span>
               <span class="crayon-sy">
                {
               </span>
               <span class="crayon-s">
                'tags'
               </span>
               <span class="crayon-o">
                :
               </span>
               <span class="crayon-s">
                'drama'
               </span>
               <span class="crayon-sy">
                }
               </span>
               <span class="crayon-sy">
                ,
               </span>
               <span class="crayon-sy">
                {
               </span>
               <span class="crayon-s">
                'debut'
               </span>
               <span class="crayon-o">
                :
               </span>
               <span class="crayon-cn">
                1
               </span>
               <span class="crayon-sy">
                ,
               </span>
               <span class="crayon-s">
                'title'
               </span>
               <span class="crayon-o">
                :
               </span>
               <span class="crayon-cn">
                1
               </span>
               <span class="crayon-sy">
                }
               </span>
               <span class="crayon-sy">
                )
               </span>
               <span class="crayon-sy">
                .
               </span>
               <span class="crayon-e">
                pretty
               </span>
               <span class="crayon-sy">
                (
               </span>
               <span class="crayon-sy">
                )
               </span>
              </div>
              <div class="crayon-line crayon-striped-line" id="crayon-5768647c9c5c7221372851-2">
              </div>
             </div>
            </td>
           </tr>
          </tbody>
         </table>
        </div>
       </div>
       <!-- [Format Time: 0.0013 seconds] -->
       <p>
        数据库将返回：
       </p>
       <!-- Crayon Syntax Highlighter v_2.7.2_beta -->
       <div class="crayon-syntax crayon-theme-classic crayon-font-monaco crayon-os-pc print-yes notranslate" data-settings=" minimize scroll-mouseover" id="crayon-5768647c9c5cd740377894" style=" margin-top: 12px; margin-bottom: 12px; font-size: 12px !important; line-height: 15px !important;">
        <div class="crayon-toolbar" data-settings=" mouseover overlay hide delay" style="font-size: 12px !important;height: 18px !important; line-height: 18px !important;">
         <span class="crayon-title">
         </span>
         <div class="crayon-tools" style="font-size: 12px !important;height: 18px !important; line-height: 18px !important;">
          <div class="crayon-button crayon-nums-button" title="切换是否显示行编号">
           <div class="crayon-button-icon">
           </div>
          </div>
          <div class="crayon-button crayon-plain-button" title="纯文本显示代码">
           <div class="crayon-button-icon">
           </div>
          </div>
          <div class="crayon-button crayon-wrap-button" title="切换自动换行">
           <div class="crayon-button-icon">
           </div>
          </div>
          <div class="crayon-button crayon-expand-button" title="点击展开代码">
           <div class="crayon-button-icon">
           </div>
          </div>
          <div class="crayon-button crayon-copy-button" title="复制代码">
           <div class="crayon-button-icon">
           </div>
          </div>
          <div class="crayon-button crayon-popup-button" title="在新窗口中显示代码">
           <div class="crayon-button-icon">
           </div>
          </div>
         </div>
        </div>
        <div class="crayon-info" style="min-height: 16.8px !important; line-height: 16.8px !important;">
        </div>
        <div class="crayon-plain-wrap">
         <textarea class="crayon-plain print-no" data-settings="dblclick" readonly="" style="-moz-tab-size:4; -o-tab-size:4; -webkit-tab-size:4; tab-size:4; font-size: 12px !important; line-height: 15px !important;" wrap="soft">
          {
    "_id" : ObjectId("549cfb42f685c085f1dd47d4"),
    "title" : "Forrest Gump",
    "debut" : ISODate("1994-08-05T16:00:00Z")
}
{
    "_id" : ObjectId("549cff96f685c085f1dd47d6"),
    "title" : "Fight Club",
    "debut" : ISODate("1999-11-14T16:00:00Z")
}
{
    "_id" : ObjectId("549cff96f685c085f1dd47d7"),
    "title" : "Seven",
    "debut" : ISODate("1995-10-21T16:00:00Z")
}
         </textarea>
        </div>
        <div class="crayon-main" style="">
         <table class="crayon-table">
          <tbody>
           <tr class="crayon-row">
            <td class="crayon-nums " data-settings="show">
             <div class="crayon-nums-content" style="font-size: 12px !important; line-height: 15px !important;">
              <div class="crayon-num" data-line="crayon-5768647c9c5cd740377894-1">
               1
              </div>
              <div class="crayon-num crayon-striped-num" data-line="crayon-5768647c9c5cd740377894-2">
               2
              </div>
              <div class="crayon-num" data-line="crayon-5768647c9c5cd740377894-3">
               3
              </div>
              <div class="crayon-num crayon-striped-num" data-line="crayon-5768647c9c5cd740377894-4">
               4
              </div>
              <div class="crayon-num" data-line="crayon-5768647c9c5cd740377894-5">
               5
              </div>
              <div class="crayon-num crayon-striped-num" data-line="crayon-5768647c9c5cd740377894-6">
               6
              </div>
              <div class="crayon-num" data-line="crayon-5768647c9c5cd740377894-7">
               7
              </div>
              <div class="crayon-num crayon-striped-num" data-line="crayon-5768647c9c5cd740377894-8">
               8
              </div>
              <div class="crayon-num" data-line="crayon-5768647c9c5cd740377894-9">
               9
              </div>
              <div class="crayon-num crayon-striped-num" data-line="crayon-5768647c9c5cd740377894-10">
               10
              </div>
              <div class="crayon-num" data-line="crayon-5768647c9c5cd740377894-11">
               11
              </div>
              <div class="crayon-num crayon-striped-num" data-line="crayon-5768647c9c5cd740377894-12">
               12
              </div>
              <div class="crayon-num" data-line="crayon-5768647c9c5cd740377894-13">
               13
              </div>
              <div class="crayon-num crayon-striped-num" data-line="crayon-5768647c9c5cd740377894-14">
               14
              </div>
              <div class="crayon-num" data-line="crayon-5768647c9c5cd740377894-15">
               15
              </div>
              <div class="crayon-num crayon-striped-num" data-line="crayon-5768647c9c5cd740377894-16">
               16
              </div>
             </div>
            </td>
            <td class="crayon-code">
             <div class="crayon-pre" style="font-size: 12px !important; line-height: 15px !important; -moz-tab-size:4; -o-tab-size:4; -webkit-tab-size:4; tab-size:4;">
              <div class="crayon-line" id="crayon-5768647c9c5cd740377894-1">
               <span class="crayon-sy">
                {
               </span>
              </div>
              <div class="crayon-line crayon-striped-line" id="crayon-5768647c9c5cd740377894-2">
               <span class="crayon-h">
               </span>
               <span class="crayon-s">
                "_id"
               </span>
               <span class="crayon-h">
               </span>
               <span class="crayon-o">
                :
               </span>
               <span class="crayon-h">
               </span>
               <span class="crayon-e">
                ObjectId
               </span>
               <span class="crayon-sy">
                (
               </span>
               <span class="crayon-s">
                "549cfb42f685c085f1dd47d4"
               </span>
               <span class="crayon-sy">
                )
               </span>
               <span class="crayon-sy">
                ,
               </span>
              </div>
              <div class="crayon-line" id="crayon-5768647c9c5cd740377894-3">
               <span class="crayon-h">
               </span>
               <span class="crayon-s">
                "title"
               </span>
               <span class="crayon-h">
               </span>
               <span class="crayon-o">
                :
               </span>
               <span class="crayon-h">
               </span>
               <span class="crayon-s">
                "Forrest Gump"
               </span>
               <span class="crayon-sy">
                ,
               </span>
              </div>
              <div class="crayon-line crayon-striped-line" id="crayon-5768647c9c5cd740377894-4">
               <span class="crayon-h">
               </span>
               <span class="crayon-s">
                "debut"
               </span>
               <span class="crayon-h">
               </span>
               <span class="crayon-o">
                :
               </span>
               <span class="crayon-h">
               </span>
               <span class="crayon-e">
                ISODate
               </span>
               <span class="crayon-sy">
                (
               </span>
               <span class="crayon-s">
                "1994-08-05T16:00:00Z"
               </span>
               <span class="crayon-sy">
                )
               </span>
              </div>
              <div class="crayon-line" id="crayon-5768647c9c5cd740377894-5">
               <span class="crayon-sy">
                }
               </span>
              </div>
              <div class="crayon-line crayon-striped-line" id="crayon-5768647c9c5cd740377894-6">
               <span class="crayon-sy">
                {
               </span>
              </div>
              <div class="crayon-line" id="crayon-5768647c9c5cd740377894-7">
               <span class="crayon-h">
               </span>
               <span class="crayon-s">
                "_id"
               </span>
               <span class="crayon-h">
               </span>
               <span class="crayon-o">
                :
               </span>
               <span class="crayon-h">
               </span>
               <span class="crayon-e">
                ObjectId
               </span>
               <span class="crayon-sy">
                (
               </span>
               <span class="crayon-s">
                "549cff96f685c085f1dd47d6"
               </span>
               <span class="crayon-sy">
                )
               </span>
               <span class="crayon-sy">
                ,
               </span>
              </div>
              <div class="crayon-line crayon-striped-line" id="crayon-5768647c9c5cd740377894-8">
               <span class="crayon-h">
               </span>
               <span class="crayon-s">
                "title"
               </span>
               <span class="crayon-h">
               </span>
               <span class="crayon-o">
                :
               </span>
               <span class="crayon-h">
               </span>
               <span class="crayon-s">
                "Fight Club"
               </span>
               <span class="crayon-sy">
                ,
               </span>
              </div>
              <div class="crayon-line" id="crayon-5768647c9c5cd740377894-9">
               <span class="crayon-h">
               </span>
               <span class="crayon-s">
                "debut"
               </span>
               <span class="crayon-h">
               </span>
               <span class="crayon-o">
                :
               </span>
               <span class="crayon-h">
               </span>
               <span class="crayon-e">
                ISODate
               </span>
               <span class="crayon-sy">
                (
               </span>
               <span class="crayon-s">
                "1999-11-14T16:00:00Z"
               </span>
               <span class="crayon-sy">
                )
               </span>
              </div>
              <div class="crayon-line crayon-striped-line" id="crayon-5768647c9c5cd740377894-10">
               <span class="crayon-sy">
                }
               </span>
              </div>
              <div class="crayon-line" id="crayon-5768647c9c5cd740377894-11">
               <span class="crayon-sy">
                {
               </span>
              </div>
              <div class="crayon-line crayon-striped-line" id="crayon-5768647c9c5cd740377894-12">
               <span class="crayon-h">
               </span>
               <span class="crayon-s">
                "_id"
               </span>
               <span class="crayon-h">
               </span>
               <span class="crayon-o">
                :
               </span>
               <span class="crayon-h">
               </span>
               <span class="crayon-e">
                ObjectId
               </span>
               <span class="crayon-sy">
                (
               </span>
               <span class="crayon-s">
                "549cff96f685c085f1dd47d7"
               </span>
               <span class="crayon-sy">
                )
               </span>
               <span class="crayon-sy">
                ,
               </span>
              </div>
              <div class="crayon-line" id="crayon-5768647c9c5cd740377894-13">
               <span class="crayon-h">
               </span>
               <span class="crayon-s">
                "title"
               </span>
               <span class="crayon-h">
               </span>
               <span class="crayon-o">
                :
               </span>
               <span class="crayon-h">
               </span>
               <span class="crayon-s">
                "Seven"
               </span>
               <span class="crayon-sy">
                ,
               </span>
              </div>
              <div class="crayon-line crayon-striped-line" id="crayon-5768647c9c5cd740377894-14">
               <span class="crayon-h">
               </span>
               <span class="crayon-s">
                "debut"
               </span>
               <span class="crayon-h">
               </span>
               <span class="crayon-o">
                :
               </span>
               <span class="crayon-h">
               </span>
               <span class="crayon-e">
                ISODate
               </span>
               <span class="crayon-sy">
                (
               </span>
               <span class="crayon-s">
                "1995-10-21T16:00:00Z"
               </span>
               <span class="crayon-sy">
                )
               </span>
              </div>
              <div class="crayon-line" id="crayon-5768647c9c5cd740377894-15">
               <span class="crayon-sy">
                }
               </span>
              </div>
              <div class="crayon-line crayon-striped-line" id="crayon-5768647c9c5cd740377894-16">
              </div>
             </div>
            </td>
           </tr>
          </tbody>
         </table>
        </div>
       </div>
       <!-- [Format Time: 0.0032 seconds] -->
       <p>
        这里find的第二个参数是用来控制输出的，1表示要返回，而0则表示不返回。默认值是0，但
        <code>
         _id
        </code>
        是例外，因此如果你不想输出
        <code>
         _id
        </code>
        ，需要显式地声明：
       </p>
       <!-- Crayon Syntax Highlighter v_2.7.2_beta -->
       <div class="crayon-syntax crayon-theme-classic crayon-font-monaco crayon-os-pc print-yes notranslate" data-settings=" minimize scroll-mouseover" id="crayon-5768647c9c5d3724405374" style=" margin-top: 12px; margin-bottom: 12px; font-size: 12px !important; line-height: 15px !important;">
        <div class="crayon-toolbar" data-settings=" mouseover overlay hide delay" style="font-size: 12px !important;height: 18px !important; line-height: 18px !important;">
         <span class="crayon-title">
         </span>
         <div class="crayon-tools" style="font-size: 12px !important;height: 18px !important; line-height: 18px !important;">
          <div class="crayon-button crayon-nums-button" title="切换是否显示行编号">
           <div class="crayon-button-icon">
           </div>
          </div>
          <div class="crayon-button crayon-plain-button" title="纯文本显示代码">
           <div class="crayon-button-icon">
           </div>
          </div>
          <div class="crayon-button crayon-wrap-button" title="切换自动换行">
           <div class="crayon-button-icon">
           </div>
          </div>
          <div class="crayon-button crayon-expand-button" title="点击展开代码">
           <div class="crayon-button-icon">
           </div>
          </div>
          <div class="crayon-button crayon-copy-button" title="复制代码">
           <div class="crayon-button-icon">
           </div>
          </div>
          <div class="crayon-button crayon-popup-button" title="在新窗口中显示代码">
           <div class="crayon-button-icon">
           </div>
          </div>
         </div>
        </div>
        <div class="crayon-info" style="min-height: 16.8px !important; line-height: 16.8px !important;">
        </div>
        <div class="crayon-plain-wrap">
         <textarea class="crayon-plain print-no" data-settings="dblclick" readonly="" style="-moz-tab-size:4; -o-tab-size:4; -webkit-tab-size:4; tab-size:4; font-size: 12px !important; line-height: 15px !important;" wrap="soft">
          db.movie.find({'tags':'drama'},{'debut':1,'title':1,'_id':0}).pretty()
         </textarea>
        </div>
        <div class="crayon-main" style="">
         <table class="crayon-table">
          <tbody>
           <tr class="crayon-row">
            <td class="crayon-nums " data-settings="show">
             <div class="crayon-nums-content" style="font-size: 12px !important; line-height: 15px !important;">
              <div class="crayon-num" data-line="crayon-5768647c9c5d3724405374-1">
               1
              </div>
              <div class="crayon-num crayon-striped-num" data-line="crayon-5768647c9c5d3724405374-2">
               2
              </div>
             </div>
            </td>
            <td class="crayon-code">
             <div class="crayon-pre" style="font-size: 12px !important; line-height: 15px !important; -moz-tab-size:4; -o-tab-size:4; -webkit-tab-size:4; tab-size:4;">
              <div class="crayon-line" id="crayon-5768647c9c5d3724405374-1">
               <span class="crayon-v">
                db
               </span>
               <span class="crayon-sy">
                .
               </span>
               <span class="crayon-v">
                movie
               </span>
               <span class="crayon-sy">
                .
               </span>
               <span class="crayon-e">
                find
               </span>
               <span class="crayon-sy">
                (
               </span>
               <span class="crayon-sy">
                {
               </span>
               <span class="crayon-s">
                'tags'
               </span>
               <span class="crayon-o">
                :
               </span>
               <span class="crayon-s">
                'drama'
               </span>
               <span class="crayon-sy">
                }
               </span>
               <span class="crayon-sy">
                ,
               </span>
               <span class="crayon-sy">
                {
               </span>
               <span class="crayon-s">
                'debut'
               </span>
               <span class="crayon-o">
                :
               </span>
               <span class="crayon-cn">
                1
               </span>
               <span class="crayon-sy">
                ,
               </span>
               <span class="crayon-s">
                'title'
               </span>
               <span class="crayon-o">
                :
               </span>
               <span class="crayon-cn">
                1
               </span>
               <span class="crayon-sy">
                ,
               </span>
               <span class="crayon-s">
                '_id'
               </span>
               <span class="crayon-o">
                :
               </span>
               <span class="crayon-cn">
                0
               </span>
               <span class="crayon-sy">
                }
               </span>
               <span class="crayon-sy">
                )
               </span>
               <span class="crayon-sy">
                .
               </span>
               <span class="crayon-e">
                pretty
               </span>
               <span class="crayon-sy">
                (
               </span>
               <span class="crayon-sy">
                )
               </span>
              </div>
              <div class="crayon-line crayon-striped-line" id="crayon-5768647c9c5d3724405374-2">
              </div>
             </div>
            </td>
           </tr>
          </tbody>
         </table>
        </div>
       </div>
       <!-- [Format Time: 0.0013 seconds] -->
       <p>
       </p>
       <h4>
        <a class="anchor" href="https://github.com/StevenSLXie/Tutorials-for-Web-Developers/blob/master/MongoDB%20%E6%9E%81%E7%AE%80%E5%AE%9E%E8%B7%B5%E5%85%A5%E9%97%A8.md#8-%E6%9B%B4%E6%96%B0" id="user-content-8-更新">
        </a>
        8. 更新
       </h4>
       <p>
        很多情况下你需要更新你的数据库，比如有人对某部电影点了个赞，那么你需要更新相应的数据库。比如有人对《七宗罪》点了个赞，而它本来的赞的个数是134370，那么你需要更新到134371。可以这样操作：
       </p>
       <!-- Crayon Syntax Highlighter v_2.7.2_beta -->
       <div class="crayon-syntax crayon-theme-classic crayon-font-monaco crayon-os-pc print-yes notranslate" data-settings=" minimize scroll-mouseover" id="crayon-5768647c9c5d9476912467" style=" margin-top: 12px; margin-bottom: 12px; font-size: 12px !important; line-height: 15px !important;">
        <div class="crayon-toolbar" data-settings=" mouseover overlay hide delay" style="font-size: 12px !important;height: 18px !important; line-height: 18px !important;">
         <span class="crayon-title">
         </span>
         <div class="crayon-tools" style="font-size: 12px !important;height: 18px !important; line-height: 18px !important;">
          <div class="crayon-button crayon-nums-button" title="切换是否显示行编号">
           <div class="crayon-button-icon">
           </div>
          </div>
          <div class="crayon-button crayon-plain-button" title="纯文本显示代码">
           <div class="crayon-button-icon">
           </div>
          </div>
          <div class="crayon-button crayon-wrap-button" title="切换自动换行">
           <div class="crayon-button-icon">
           </div>
          </div>
          <div class="crayon-button crayon-expand-button" title="点击展开代码">
           <div class="crayon-button-icon">
           </div>
          </div>
          <div class="crayon-button crayon-copy-button" title="复制代码">
           <div class="crayon-button-icon">
           </div>
          </div>
          <div class="crayon-button crayon-popup-button" title="在新窗口中显示代码">
           <div class="crayon-button-icon">
           </div>
          </div>
         </div>
        </div>
        <div class="crayon-info" style="min-height: 16.8px !important; line-height: 16.8px !important;">
        </div>
        <div class="crayon-plain-wrap">
         <textarea class="crayon-plain print-no" data-settings="dblclick" readonly="" style="-moz-tab-size:4; -o-tab-size:4; -webkit-tab-size:4; tab-size:4; font-size: 12px !important; line-height: 15px !important;" wrap="soft">
          db.movie.update({title:'Seven'}, {$set:{likes:134371}})
         </textarea>
        </div>
        <div class="crayon-main" style="">
         <table class="crayon-table">
          <tbody>
           <tr class="crayon-row">
            <td class="crayon-nums " data-settings="show">
             <div class="crayon-nums-content" style="font-size: 12px !important; line-height: 15px !important;">
              <div class="crayon-num" data-line="crayon-5768647c9c5d9476912467-1">
               1
              </div>
              <div class="crayon-num crayon-striped-num" data-line="crayon-5768647c9c5d9476912467-2">
               2
              </div>
             </div>
            </td>
            <td class="crayon-code">
             <div class="crayon-pre" style="font-size: 12px !important; line-height: 15px !important; -moz-tab-size:4; -o-tab-size:4; -webkit-tab-size:4; tab-size:4;">
              <div class="crayon-line" id="crayon-5768647c9c5d9476912467-1">
               <span class="crayon-v">
                db
               </span>
               <span class="crayon-sy">
                .
               </span>
               <span class="crayon-v">
                movie
               </span>
               <span class="crayon-sy">
                .
               </span>
               <span class="crayon-e">
                update
               </span>
               <span class="crayon-sy">
                (
               </span>
               <span class="crayon-sy">
                {
               </span>
               <span class="crayon-v">
                title
               </span>
               <span class="crayon-o">
                :
               </span>
               <span class="crayon-s">
                'Seven'
               </span>
               <span class="crayon-sy">
                }
               </span>
               <span class="crayon-sy">
                ,
               </span>
               <span class="crayon-h">
               </span>
               <span class="crayon-sy">
                {
               </span>
               <span class="crayon-sy">
                $
               </span>
               <span class="crayon-v">
                set
               </span>
               <span class="crayon-o">
                :
               </span>
               <span class="crayon-sy">
                {
               </span>
               <span class="crayon-v">
                likes
               </span>
               <span class="crayon-o">
                :
               </span>
               <span class="crayon-cn">
                134371
               </span>
               <span class="crayon-sy">
                }
               </span>
               <span class="crayon-sy">
                }
               </span>
               <span class="crayon-sy">
                )
               </span>
              </div>
              <div class="crayon-line crayon-striped-line" id="crayon-5768647c9c5d9476912467-2">
              </div>
             </div>
            </td>
           </tr>
          </tbody>
         </table>
        </div>
       </div>
       <!-- [Format Time: 0.0012 seconds] -->
       <p>
        第一个大括号里表明要选取的对象，第二个表明要改动的数据。请注意上述的操作相当不现实，因为你首先要知道之前的数字是多少，然后加一，但通常你不读取数据库的话，是不会知道这个数(134370)的。MongoDB提供了一种简便的方法，可以对现有条目进行增量操作。假设又有人对《七宗罪》点了两个赞，则可以：
       </p>
       <!-- Crayon Syntax Highlighter v_2.7.2_beta -->
       <div class="crayon-syntax crayon-theme-classic crayon-font-monaco crayon-os-pc print-yes notranslate" data-settings=" minimize scroll-mouseover" id="crayon-5768647c9c5df281825805" style=" margin-top: 12px; margin-bottom: 12px; font-size: 12px !important; line-height: 15px !important;">
        <div class="crayon-toolbar" data-settings=" mouseover overlay hide delay" style="font-size: 12px !important;height: 18px !important; line-height: 18px !important;">
         <span class="crayon-title">
         </span>
         <div class="crayon-tools" style="font-size: 12px !important;height: 18px !important; line-height: 18px !important;">
          <div class="crayon-button crayon-nums-button" title="切换是否显示行编号">
           <div class="crayon-button-icon">
           </div>
          </div>
          <div class="crayon-button crayon-plain-button" title="纯文本显示代码">
           <div class="crayon-button-icon">
           </div>
          </div>
          <div class="crayon-button crayon-wrap-button" title="切换自动换行">
           <div class="crayon-button-icon">
           </div>
          </div>
          <div class="crayon-button crayon-expand-button" title="点击展开代码">
           <div class="crayon-button-icon">
           </div>
          </div>
          <div class="crayon-button crayon-copy-button" title="复制代码">
           <div class="crayon-button-icon">
           </div>
          </div>
          <div class="crayon-button crayon-popup-button" title="在新窗口中显示代码">
           <div class="crayon-button-icon">
           </div>
          </div>
         </div>
        </div>
        <div class="crayon-info" style="min-height: 16.8px !important; line-height: 16.8px !important;">
        </div>
        <div class="crayon-plain-wrap">
         <textarea class="crayon-plain print-no" data-settings="dblclick" readonly="" style="-moz-tab-size:4; -o-tab-size:4; -webkit-tab-size:4; tab-size:4; font-size: 12px !important; line-height: 15px !important;" wrap="soft">
          db.movie.update({title:'Seven'}, {$inc:{likes:2}})
         </textarea>
        </div>
        <div class="crayon-main" style="">
         <table class="crayon-table">
          <tbody>
           <tr class="crayon-row">
            <td class="crayon-nums " data-settings="show">
             <div class="crayon-nums-content" style="font-size: 12px !important; line-height: 15px !important;">
              <div class="crayon-num" data-line="crayon-5768647c9c5df281825805-1">
               1
              </div>
              <div class="crayon-num crayon-striped-num" data-line="crayon-5768647c9c5df281825805-2">
               2
              </div>
             </div>
            </td>
            <td class="crayon-code">
             <div class="crayon-pre" style="font-size: 12px !important; line-height: 15px !important; -moz-tab-size:4; -o-tab-size:4; -webkit-tab-size:4; tab-size:4;">
              <div class="crayon-line" id="crayon-5768647c9c5df281825805-1">
               <span class="crayon-v">
                db
               </span>
               <span class="crayon-sy">
                .
               </span>
               <span class="crayon-v">
                movie
               </span>
               <span class="crayon-sy">
                .
               </span>
               <span class="crayon-e">
                update
               </span>
               <span class="crayon-sy">
                (
               </span>
               <span class="crayon-sy">
                {
               </span>
               <span class="crayon-v">
                title
               </span>
               <span class="crayon-o">
                :
               </span>
               <span class="crayon-s">
                'Seven'
               </span>
               <span class="crayon-sy">
                }
               </span>
               <span class="crayon-sy">
                ,
               </span>
               <span class="crayon-h">
               </span>
               <span class="crayon-sy">
                {
               </span>
               <span class="crayon-sy">
                $
               </span>
               <span class="crayon-v">
                inc
               </span>
               <span class="crayon-o">
                :
               </span>
               <span class="crayon-sy">
                {
               </span>
               <span class="crayon-v">
                likes
               </span>
               <span class="crayon-o">
                :
               </span>
               <span class="crayon-cn">
                2
               </span>
               <span class="crayon-sy">
                }
               </span>
               <span class="crayon-sy">
                }
               </span>
               <span class="crayon-sy">
                )
               </span>
              </div>
              <div class="crayon-line crayon-striped-line" id="crayon-5768647c9c5df281825805-2">
              </div>
             </div>
            </td>
           </tr>
          </tbody>
         </table>
        </div>
       </div>
       <!-- [Format Time: 0.0011 seconds] -->
       <p>
        如果你查询的话，会发现点赞数变为134373了，这里用的是
        <code>
         $inc
        </code>
        。除了增量更新，MongoDB还提供了很多灵活的更新选项，具体可以看：
        <a href="http://docs.mongodb.org/manual/reference/operator/update-field/">
         http://docs.mongodb.org/manual/reference/operator/update-field/
        </a>
        。
       </p>
       <p>
        注意如果有多部符合要求的电影。则默认只会更新第一个。如果要多个同时更新，要设置
        <code>
         {multi:true}
        </code>
        ，像下面这样：
       </p>
       <!-- Crayon Syntax Highlighter v_2.7.2_beta -->
       <div class="crayon-syntax crayon-theme-classic crayon-font-monaco crayon-os-pc print-yes notranslate" data-settings=" minimize scroll-mouseover" id="crayon-5768647c9c5e5521103411" style=" margin-top: 12px; margin-bottom: 12px; font-size: 12px !important; line-height: 15px !important;">
        <div class="crayon-toolbar" data-settings=" mouseover overlay hide delay" style="font-size: 12px !important;height: 18px !important; line-height: 18px !important;">
         <span class="crayon-title">
         </span>
         <div class="crayon-tools" style="font-size: 12px !important;height: 18px !important; line-height: 18px !important;">
          <div class="crayon-button crayon-nums-button" title="切换是否显示行编号">
           <div class="crayon-button-icon">
           </div>
          </div>
          <div class="crayon-button crayon-plain-button" title="纯文本显示代码">
           <div class="crayon-button-icon">
           </div>
          </div>
          <div class="crayon-button crayon-wrap-button" title="切换自动换行">
           <div class="crayon-button-icon">
           </div>
          </div>
          <div class="crayon-button crayon-expand-button" title="点击展开代码">
           <div class="crayon-button-icon">
           </div>
          </div>
          <div class="crayon-button crayon-copy-button" title="复制代码">
           <div class="crayon-button-icon">
           </div>
          </div>
          <div class="crayon-button crayon-popup-button" title="在新窗口中显示代码">
           <div class="crayon-button-icon">
           </div>
          </div>
         </div>
        </div>
        <div class="crayon-info" style="min-height: 16.8px !important; line-height: 16.8px !important;">
        </div>
        <div class="crayon-plain-wrap">
         <textarea class="crayon-plain print-no" data-settings="dblclick" readonly="" style="-moz-tab-size:4; -o-tab-size:4; -webkit-tab-size:4; tab-size:4; font-size: 12px !important; line-height: 15px !important;" wrap="soft">
          db.movie.update({}, {$inc:{likes:10}},{multi:true})
         </textarea>
        </div>
        <div class="crayon-main" style="">
         <table class="crayon-table">
          <tbody>
           <tr class="crayon-row">
            <td class="crayon-nums " data-settings="show">
             <div class="crayon-nums-content" style="font-size: 12px !important; line-height: 15px !important;">
              <div class="crayon-num" data-line="crayon-5768647c9c5e5521103411-1">
               1
              </div>
              <div class="crayon-num crayon-striped-num" data-line="crayon-5768647c9c5e5521103411-2">
               2
              </div>
             </div>
            </td>
            <td class="crayon-code">
             <div class="crayon-pre" style="font-size: 12px !important; line-height: 15px !important; -moz-tab-size:4; -o-tab-size:4; -webkit-tab-size:4; tab-size:4;">
              <div class="crayon-line" id="crayon-5768647c9c5e5521103411-1">
               <span class="crayon-v">
                db
               </span>
               <span class="crayon-sy">
                .
               </span>
               <span class="crayon-v">
                movie
               </span>
               <span class="crayon-sy">
                .
               </span>
               <span class="crayon-e">
                update
               </span>
               <span class="crayon-sy">
                (
               </span>
               <span class="crayon-sy">
                {
               </span>
               <span class="crayon-sy">
                }
               </span>
               <span class="crayon-sy">
                ,
               </span>
               <span class="crayon-h">
               </span>
               <span class="crayon-sy">
                {
               </span>
               <span class="crayon-sy">
                $
               </span>
               <span class="crayon-v">
                inc
               </span>
               <span class="crayon-o">
                :
               </span>
               <span class="crayon-sy">
                {
               </span>
               <span class="crayon-v">
                likes
               </span>
               <span class="crayon-o">
                :
               </span>
               <span class="crayon-cn">
                10
               </span>
               <span class="crayon-sy">
                }
               </span>
               <span class="crayon-sy">
                }
               </span>
               <span class="crayon-sy">
                ,
               </span>
               <span class="crayon-sy">
                {
               </span>
               <span class="crayon-v">
                multi
               </span>
               <span class="crayon-o">
                :
               </span>
               <span class="crayon-t">
                true
               </span>
               <span class="crayon-sy">
                }
               </span>
               <span class="crayon-sy">
                )
               </span>
              </div>
              <div class="crayon-line crayon-striped-line" id="crayon-5768647c9c5e5521103411-2">
              </div>
             </div>
            </td>
           </tr>
          </tbody>
         </table>
        </div>
       </div>
       <!-- [Format Time: 0.0016 seconds] -->
       <p>
        所有电影的赞数都多了10.
       </p>
       <p>
        注意，以上的更新操作会替换掉原来的值，所以如果你是想在原有的值得基础上增加一个值的话，则应该用
        <code>
         $push
        </code>
        ，比如，为《七宗罪》添加一个popular的tags。
       </p>
       <!-- Crayon Syntax Highlighter v_2.7.2_beta -->
       <div class="crayon-syntax crayon-theme-classic crayon-font-monaco crayon-os-pc print-yes notranslate" data-settings=" minimize scroll-mouseover" id="crayon-5768647c9c5ea801489939" style=" margin-top: 12px; margin-bottom: 12px; font-size: 12px !important; line-height: 15px !important;">
        <div class="crayon-toolbar" data-settings=" mouseover overlay hide delay" style="font-size: 12px !important;height: 18px !important; line-height: 18px !important;">
         <span class="crayon-title">
         </span>
         <div class="crayon-tools" style="font-size: 12px !important;height: 18px !important; line-height: 18px !important;">
          <div class="crayon-button crayon-nums-button" title="切换是否显示行编号">
           <div class="crayon-button-icon">
           </div>
          </div>
          <div class="crayon-button crayon-plain-button" title="纯文本显示代码">
           <div class="crayon-button-icon">
           </div>
          </div>
          <div class="crayon-button crayon-wrap-button" title="切换自动换行">
           <div class="crayon-button-icon">
           </div>
          </div>
          <div class="crayon-button crayon-expand-button" title="点击展开代码">
           <div class="crayon-button-icon">
           </div>
          </div>
          <div class="crayon-button crayon-copy-button" title="复制代码">
           <div class="crayon-button-icon">
           </div>
          </div>
          <div class="crayon-button crayon-popup-button" title="在新窗口中显示代码">
           <div class="crayon-button-icon">
           </div>
          </div>
         </div>
        </div>
        <div class="crayon-info" style="min-height: 16.8px !important; line-height: 16.8px !important;">
        </div>
        <div class="crayon-plain-wrap">
         <textarea class="crayon-plain print-no" data-settings="dblclick" readonly="" style="-moz-tab-size:4; -o-tab-size:4; -webkit-tab-size:4; tab-size:4; font-size: 12px !important; line-height: 15px !important;" wrap="soft">
          db.movie.update({'title':'Seven'}, {$push:{'tags':'popular'}})
         </textarea>
        </div>
        <div class="crayon-main" style="">
         <table class="crayon-table">
          <tbody>
           <tr class="crayon-row">
            <td class="crayon-nums " data-settings="show">
             <div class="crayon-nums-content" style="font-size: 12px !important; line-height: 15px !important;">
              <div class="crayon-num" data-line="crayon-5768647c9c5ea801489939-1">
               1
              </div>
              <div class="crayon-num crayon-striped-num" data-line="crayon-5768647c9c5ea801489939-2">
               2
              </div>
             </div>
            </td>
            <td class="crayon-code">
             <div class="crayon-pre" style="font-size: 12px !important; line-height: 15px !important; -moz-tab-size:4; -o-tab-size:4; -webkit-tab-size:4; tab-size:4;">
              <div class="crayon-line" id="crayon-5768647c9c5ea801489939-1">
               <span class="crayon-v">
                db
               </span>
               <span class="crayon-sy">
                .
               </span>
               <span class="crayon-v">
                movie
               </span>
               <span class="crayon-sy">
                .
               </span>
               <span class="crayon-e">
                update
               </span>
               <span class="crayon-sy">
                (
               </span>
               <span class="crayon-sy">
                {
               </span>
               <span class="crayon-s">
                'title'
               </span>
               <span class="crayon-o">
                :
               </span>
               <span class="crayon-s">
                'Seven'
               </span>
               <span class="crayon-sy">
                }
               </span>
               <span class="crayon-sy">
                ,
               </span>
               <span class="crayon-h">
               </span>
               <span class="crayon-sy">
                {
               </span>
               <span class="crayon-sy">
                $
               </span>
               <span class="crayon-v">
                push
               </span>
               <span class="crayon-o">
                :
               </span>
               <span class="crayon-sy">
                {
               </span>
               <span class="crayon-s">
                'tags'
               </span>
               <span class="crayon-o">
                :
               </span>
               <span class="crayon-s">
                'popular'
               </span>
               <span class="crayon-sy">
                }
               </span>
               <span class="crayon-sy">
                }
               </span>
               <span class="crayon-sy">
                )
               </span>
              </div>
              <div class="crayon-line crayon-striped-line" id="crayon-5768647c9c5ea801489939-2">
              </div>
             </div>
            </td>
           </tr>
          </tbody>
         </table>
        </div>
       </div>
       <!-- [Format Time: 0.0013 seconds] -->
       <p>
        你会发现《七宗罪》现在有四个标签：
       </p>
       <!-- Crayon Syntax Highlighter v_2.7.2_beta -->
       <div class="crayon-syntax crayon-theme-classic crayon-font-monaco crayon-os-pc print-yes notranslate" data-settings=" minimize scroll-mouseover" id="crayon-5768647c9c5f0196690437" style=" margin-top: 12px; margin-bottom: 12px; font-size: 12px !important; line-height: 15px !important;">
        <div class="crayon-toolbar" data-settings=" mouseover overlay hide delay" style="font-size: 12px !important;height: 18px !important; line-height: 18px !important;">
         <span class="crayon-title">
         </span>
         <div class="crayon-tools" style="font-size: 12px !important;height: 18px !important; line-height: 18px !important;">
          <div class="crayon-button crayon-nums-button" title="切换是否显示行编号">
           <div class="crayon-button-icon">
           </div>
          </div>
          <div class="crayon-button crayon-plain-button" title="纯文本显示代码">
           <div class="crayon-button-icon">
           </div>
          </div>
          <div class="crayon-button crayon-wrap-button" title="切换自动换行">
           <div class="crayon-button-icon">
           </div>
          </div>
          <div class="crayon-button crayon-expand-button" title="点击展开代码">
           <div class="crayon-button-icon">
           </div>
          </div>
          <div class="crayon-button crayon-copy-button" title="复制代码">
           <div class="crayon-button-icon">
           </div>
          </div>
          <div class="crayon-button crayon-popup-button" title="在新窗口中显示代码">
           <div class="crayon-button-icon">
           </div>
          </div>
         </div>
        </div>
        <div class="crayon-info" style="min-height: 16.8px !important; line-height: 16.8px !important;">
        </div>
        <div class="crayon-plain-wrap">
         <textarea class="crayon-plain print-no" data-settings="dblclick" readonly="" style="-moz-tab-size:4; -o-tab-size:4; -webkit-tab-size:4; tab-size:4; font-size: 12px !important; line-height: 15px !important;" wrap="soft">
          "tags" : [
        "drama",
        "mystery",
        "thiller",
        "popular"
    ],
         </textarea>
        </div>
        <div class="crayon-main" style="">
         <table class="crayon-table">
          <tbody>
           <tr class="crayon-row">
            <td class="crayon-nums " data-settings="show">
             <div class="crayon-nums-content" style="font-size: 12px !important; line-height: 15px !important;">
              <div class="crayon-num" data-line="crayon-5768647c9c5f0196690437-1">
               1
              </div>
              <div class="crayon-num crayon-striped-num" data-line="crayon-5768647c9c5f0196690437-2">
               2
              </div>
              <div class="crayon-num" data-line="crayon-5768647c9c5f0196690437-3">
               3
              </div>
              <div class="crayon-num crayon-striped-num" data-line="crayon-5768647c9c5f0196690437-4">
               4
              </div>
              <div class="crayon-num" data-line="crayon-5768647c9c5f0196690437-5">
               5
              </div>
              <div class="crayon-num crayon-striped-num" data-line="crayon-5768647c9c5f0196690437-6">
               6
              </div>
              <div class="crayon-num" data-line="crayon-5768647c9c5f0196690437-7">
               7
              </div>
              <div class="crayon-num crayon-striped-num" data-line="crayon-5768647c9c5f0196690437-8">
               8
              </div>
             </div>
            </td>
            <td class="crayon-code">
             <div class="crayon-pre" style="font-size: 12px !important; line-height: 15px !important; -moz-tab-size:4; -o-tab-size:4; -webkit-tab-size:4; tab-size:4;">
              <div class="crayon-line" id="crayon-5768647c9c5f0196690437-1">
               <span class="crayon-h">
               </span>
               <span class="crayon-s">
                "tags"
               </span>
               <span class="crayon-h">
               </span>
               <span class="crayon-o">
                :
               </span>
               <span class="crayon-h">
               </span>
               <span class="crayon-sy">
                [
               </span>
              </div>
              <div class="crayon-line crayon-striped-line" id="crayon-5768647c9c5f0196690437-2">
               <span class="crayon-h">
               </span>
               <span class="crayon-s">
                "drama"
               </span>
               <span class="crayon-sy">
                ,
               </span>
              </div>
              <div class="crayon-line" id="crayon-5768647c9c5f0196690437-3">
               <span class="crayon-h">
               </span>
               <span class="crayon-s">
                "mystery"
               </span>
               <span class="crayon-sy">
                ,
               </span>
              </div>
              <div class="crayon-line crayon-striped-line" id="crayon-5768647c9c5f0196690437-4">
               <span class="crayon-h">
               </span>
               <span class="crayon-s">
                "thiller"
               </span>
               <span class="crayon-sy">
                ,
               </span>
              </div>
              <div class="crayon-line" id="crayon-5768647c9c5f0196690437-5">
               <span class="crayon-h">
               </span>
               <span class="crayon-s">
                "popular"
               </span>
              </div>
              <div class="crayon-line crayon-striped-line" id="crayon-5768647c9c5f0196690437-6">
               <span class="crayon-h">
               </span>
               <span class="crayon-sy">
                ]
               </span>
               <span class="crayon-sy">
                ,
               </span>
              </div>
              <div class="crayon-line" id="crayon-5768647c9c5f0196690437-7">
              </div>
              <div class="crayon-line crayon-striped-line" id="crayon-5768647c9c5f0196690437-8">
              </div>
             </div>
            </td>
           </tr>
          </tbody>
         </table>
        </div>
       </div>
       <!-- [Format Time: 0.0011 seconds] -->
       <p>
       </p>
       <h4>
        <a class="anchor" href="https://github.com/StevenSLXie/Tutorials-for-Web-Developers/blob/master/MongoDB%20%E6%9E%81%E7%AE%80%E5%AE%9E%E8%B7%B5%E5%85%A5%E9%97%A8.md#9-%E5%88%A0%E9%99%A4" id="user-content-9-删除">
        </a>
        9. 删除
       </h4>
       <p>
        删除的句法和find很相似，比如，要删除标签为romance的电影，则：
       </p>
       <!-- Crayon Syntax Highlighter v_2.7.2_beta -->
       <div class="crayon-syntax crayon-theme-classic crayon-font-monaco crayon-os-pc print-yes notranslate" data-settings=" minimize scroll-mouseover" id="crayon-5768647c9c5f6028041793" style=" margin-top: 12px; margin-bottom: 12px; font-size: 12px !important; line-height: 15px !important;">
        <div class="crayon-toolbar" data-settings=" mouseover overlay hide delay" style="font-size: 12px !important;height: 18px !important; line-height: 18px !important;">
         <span class="crayon-title">
         </span>
         <div class="crayon-tools" style="font-size: 12px !important;height: 18px !important; line-height: 18px !important;">
          <div class="crayon-button crayon-nums-button" title="切换是否显示行编号">
           <div class="crayon-button-icon">
           </div>
          </div>
          <div class="crayon-button crayon-plain-button" title="纯文本显示代码">
           <div class="crayon-button-icon">
           </div>
          </div>
          <div class="crayon-button crayon-wrap-button" title="切换自动换行">
           <div class="crayon-button-icon">
           </div>
          </div>
          <div class="crayon-button crayon-expand-button" title="点击展开代码">
           <div class="crayon-button-icon">
           </div>
          </div>
          <div class="crayon-button crayon-copy-button" title="复制代码">
           <div class="crayon-button-icon">
           </div>
          </div>
          <div class="crayon-button crayon-popup-button" title="在新窗口中显示代码">
           <div class="crayon-button-icon">
           </div>
          </div>
         </div>
        </div>
        <div class="crayon-info" style="min-height: 16.8px !important; line-height: 16.8px !important;">
        </div>
        <div class="crayon-plain-wrap">
         <textarea class="crayon-plain print-no" data-settings="dblclick" readonly="" style="-moz-tab-size:4; -o-tab-size:4; -webkit-tab-size:4; tab-size:4; font-size: 12px !important; line-height: 15px !important;" wrap="soft">
          db.movie.remove({'tags':'romance'})
         </textarea>
        </div>
        <div class="crayon-main" style="">
         <table class="crayon-table">
          <tbody>
           <tr class="crayon-row">
            <td class="crayon-nums " data-settings="show">
             <div class="crayon-nums-content" style="font-size: 12px !important; line-height: 15px !important;">
              <div class="crayon-num" data-line="crayon-5768647c9c5f6028041793-1">
               1
              </div>
              <div class="crayon-num crayon-striped-num" data-line="crayon-5768647c9c5f6028041793-2">
               2
              </div>
             </div>
            </td>
            <td class="crayon-code">
             <div class="crayon-pre" style="font-size: 12px !important; line-height: 15px !important; -moz-tab-size:4; -o-tab-size:4; -webkit-tab-size:4; tab-size:4;">
              <div class="crayon-line" id="crayon-5768647c9c5f6028041793-1">
               <span class="crayon-v">
                db
               </span>
               <span class="crayon-sy">
                .
               </span>
               <span class="crayon-v">
                movie
               </span>
               <span class="crayon-sy">
                .
               </span>
               <span class="crayon-e">
                remove
               </span>
               <span class="crayon-sy">
                (
               </span>
               <span class="crayon-sy">
                {
               </span>
               <span class="crayon-s">
                'tags'
               </span>
               <span class="crayon-o">
                :
               </span>
               <span class="crayon-s">
                'romance'
               </span>
               <span class="crayon-sy">
                }
               </span>
               <span class="crayon-sy">
                )
               </span>
              </div>
              <div class="crayon-line crayon-striped-line" id="crayon-5768647c9c5f6028041793-2">
              </div>
             </div>
            </td>
           </tr>
          </tbody>
         </table>
        </div>
       </div>
       <!-- [Format Time: 0.0007 seconds] -->
       <p>
        考虑到我们数据库条目异常稀少，就不建议你执行这条命令了~
       </p>
       <p>
        注意，上面的例子会删除所有标签包含romance的电影。如果你只想删除第一个，则
       </p>
       <!-- Crayon Syntax Highlighter v_2.7.2_beta -->
       <div class="crayon-syntax crayon-theme-classic crayon-font-monaco crayon-os-pc print-yes notranslate" data-settings=" minimize scroll-mouseover" id="crayon-5768647c9c5fc984641542" style=" margin-top: 12px; margin-bottom: 12px; font-size: 12px !important; line-height: 15px !important;">
        <div class="crayon-toolbar" data-settings=" mouseover overlay hide delay" style="font-size: 12px !important;height: 18px !important; line-height: 18px !important;">
         <span class="crayon-title">
         </span>
         <div class="crayon-tools" style="font-size: 12px !important;height: 18px !important; line-height: 18px !important;">
          <div class="crayon-button crayon-nums-button" title="切换是否显示行编号">
           <div class="crayon-button-icon">
           </div>
          </div>
          <div class="crayon-button crayon-plain-button" title="纯文本显示代码">
           <div class="crayon-button-icon">
           </div>
          </div>
          <div class="crayon-button crayon-wrap-button" title="切换自动换行">
           <div class="crayon-button-icon">
           </div>
          </div>
          <div class="crayon-button crayon-expand-button" title="点击展开代码">
           <div class="crayon-button-icon">
           </div>
          </div>
          <div class="crayon-button crayon-copy-button" title="复制代码">
           <div class="crayon-button-icon">
           </div>
          </div>
          <div class="crayon-button crayon-popup-button" title="在新窗口中显示代码">
           <div class="crayon-button-icon">
           </div>
          </div>
         </div>
        </div>
        <div class="crayon-info" style="min-height: 16.8px !important; line-height: 16.8px !important;">
        </div>
        <div class="crayon-plain-wrap">
         <textarea class="crayon-plain print-no" data-settings="dblclick" readonly="" style="-moz-tab-size:4; -o-tab-size:4; -webkit-tab-size:4; tab-size:4; font-size: 12px !important; line-height: 15px !important;" wrap="soft">
          db.movie.remove({'tags':'romance'},1)
         </textarea>
        </div>
        <div class="crayon-main" style="">
         <table class="crayon-table">
          <tbody>
           <tr class="crayon-row">
            <td class="crayon-nums " data-settings="show">
             <div class="crayon-nums-content" style="font-size: 12px !important; line-height: 15px !important;">
              <div class="crayon-num" data-line="crayon-5768647c9c5fc984641542-1">
               1
              </div>
              <div class="crayon-num crayon-striped-num" data-line="crayon-5768647c9c5fc984641542-2">
               2
              </div>
             </div>
            </td>
            <td class="crayon-code">
             <div class="crayon-pre" style="font-size: 12px !important; line-height: 15px !important; -moz-tab-size:4; -o-tab-size:4; -webkit-tab-size:4; tab-size:4;">
              <div class="crayon-line" id="crayon-5768647c9c5fc984641542-1">
               <span class="crayon-v">
                db
               </span>
               <span class="crayon-sy">
                .
               </span>
               <span class="crayon-v">
                movie
               </span>
               <span class="crayon-sy">
                .
               </span>
               <span class="crayon-e">
                remove
               </span>
               <span class="crayon-sy">
                (
               </span>
               <span class="crayon-sy">
                {
               </span>
               <span class="crayon-s">
                'tags'
               </span>
               <span class="crayon-o">
                :
               </span>
               <span class="crayon-s">
                'romance'
               </span>
               <span class="crayon-sy">
                }
               </span>
               <span class="crayon-sy">
                ,
               </span>
               <span class="crayon-cn">
                1
               </span>
               <span class="crayon-sy">
                )
               </span>
              </div>
              <div class="crayon-line crayon-striped-line" id="crayon-5768647c9c5fc984641542-2">
              </div>
             </div>
            </td>
           </tr>
          </tbody>
         </table>
        </div>
       </div>
       <!-- [Format Time: 0.0010 seconds] -->
       <p>
        如果不加任何限制：
       </p>
       <!-- Crayon Syntax Highlighter v_2.7.2_beta -->
       <div class="crayon-syntax crayon-theme-classic crayon-font-monaco crayon-os-pc print-yes notranslate" data-settings=" minimize scroll-mouseover" id="crayon-5768647c9c601213214344" style=" margin-top: 12px; margin-bottom: 12px; font-size: 12px !important; line-height: 15px !important;">
        <div class="crayon-toolbar" data-settings=" mouseover overlay hide delay" style="font-size: 12px !important;height: 18px !important; line-height: 18px !important;">
         <span class="crayon-title">
         </span>
         <div class="crayon-tools" style="font-size: 12px !important;height: 18px !important; line-height: 18px !important;">
          <div class="crayon-button crayon-nums-button" title="切换是否显示行编号">
           <div class="crayon-button-icon">
           </div>
          </div>
          <div class="crayon-button crayon-plain-button" title="纯文本显示代码">
           <div class="crayon-button-icon">
           </div>
          </div>
          <div class="crayon-button crayon-wrap-button" title="切换自动换行">
           <div class="crayon-button-icon">
           </div>
          </div>
          <div class="crayon-button crayon-expand-button" title="点击展开代码">
           <div class="crayon-button-icon">
           </div>
          </div>
          <div class="crayon-button crayon-copy-button" title="复制代码">
           <div class="crayon-button-icon">
           </div>
          </div>
          <div class="crayon-button crayon-popup-button" title="在新窗口中显示代码">
           <div class="crayon-button-icon">
           </div>
          </div>
         </div>
        </div>
        <div class="crayon-info" style="min-height: 16.8px !important; line-height: 16.8px !important;">
        </div>
        <div class="crayon-plain-wrap">
         <textarea class="crayon-plain print-no" data-settings="dblclick" readonly="" style="-moz-tab-size:4; -o-tab-size:4; -webkit-tab-size:4; tab-size:4; font-size: 12px !important; line-height: 15px !important;" wrap="soft">
          db.movie.remove()
         </textarea>
        </div>
        <div class="crayon-main" style="">
         <table class="crayon-table">
          <tbody>
           <tr class="crayon-row">
            <td class="crayon-nums " data-settings="show">
             <div class="crayon-nums-content" style="font-size: 12px !important; line-height: 15px !important;">
              <div class="crayon-num" data-line="crayon-5768647c9c601213214344-1">
               1
              </div>
              <div class="crayon-num crayon-striped-num" data-line="crayon-5768647c9c601213214344-2">
               2
              </div>
             </div>
            </td>
            <td class="crayon-code">
             <div class="crayon-pre" style="font-size: 12px !important; line-height: 15px !important; -moz-tab-size:4; -o-tab-size:4; -webkit-tab-size:4; tab-size:4;">
              <div class="crayon-line" id="crayon-5768647c9c601213214344-1">
               <span class="crayon-v">
                db
               </span>
               <span class="crayon-sy">
                .
               </span>
               <span class="crayon-v">
                movie
               </span>
               <span class="crayon-sy">
                .
               </span>
               <span class="crayon-e">
                remove
               </span>
               <span class="crayon-sy">
                (
               </span>
               <span class="crayon-sy">
                )
               </span>
              </div>
              <div class="crayon-line crayon-striped-line" id="crayon-5768647c9c601213214344-2">
              </div>
             </div>
            </td>
           </tr>
          </tbody>
         </table>
        </div>
       </div>
       <!-- [Format Time: 0.0007 seconds] -->
       <p>
        会删除movie这个集合下的所有文件。
       </p>
       <h4>
        <a class="anchor" href="https://github.com/StevenSLXie/Tutorials-for-Web-Developers/blob/master/MongoDB%20%E6%9E%81%E7%AE%80%E5%AE%9E%E8%B7%B5%E5%85%A5%E9%97%A8.md#10-%E7%B4%A2%E5%BC%95%E5%92%8C%E6%8E%92%E5%BA%8F" id="user-content-10-索引和排序">
        </a>
        10. 索引和排序
       </h4>
       <p>
        为文件中的一些key加上索引(index)可以加快搜索速度。这一点不难理解，假如没有没有索引，我们要查找名字为Seven的电影，就必须在所有文件里逐个搜索。而如果对名字这个key加上索引值，则电影名这个字符串和数字建立了映射，这样在搜索的时候就会快很多。排序的时候也是如此，不赘述。MongoDB里面为某个key加上索引的方式很简单，比如我们要对导演这个key加索引，则可以：
       </p>
       <!-- Crayon Syntax Highlighter v_2.7.2_beta -->
       <div class="crayon-syntax crayon-theme-classic crayon-font-monaco crayon-os-pc print-yes notranslate" data-settings=" minimize scroll-mouseover" id="crayon-5768647c9c607784162399" style=" margin-top: 12px; margin-bottom: 12px; font-size: 12px !important; line-height: 15px !important;">
        <div class="crayon-toolbar" data-settings=" mouseover overlay hide delay" style="font-size: 12px !important;height: 18px !important; line-height: 18px !important;">
         <span class="crayon-title">
         </span>
         <div class="crayon-tools" style="font-size: 12px !important;height: 18px !important; line-height: 18px !important;">
          <div class="crayon-button crayon-nums-button" title="切换是否显示行编号">
           <div class="crayon-button-icon">
           </div>
          </div>
          <div class="crayon-button crayon-plain-button" title="纯文本显示代码">
           <div class="crayon-button-icon">
           </div>
          </div>
          <div class="crayon-button crayon-wrap-button" title="切换自动换行">
           <div class="crayon-button-icon">
           </div>
          </div>
          <div class="crayon-button crayon-expand-button" title="点击展开代码">
           <div class="crayon-button-icon">
           </div>
          </div>
          <div class="crayon-button crayon-copy-button" title="复制代码">
           <div class="crayon-button-icon">
           </div>
          </div>
          <div class="crayon-button crayon-popup-button" title="在新窗口中显示代码">
           <div class="crayon-button-icon">
           </div>
          </div>
         </div>
        </div>
        <div class="crayon-info" style="min-height: 16.8px !important; line-height: 16.8px !important;">
        </div>
        <div class="crayon-plain-wrap">
         <textarea class="crayon-plain print-no" data-settings="dblclick" readonly="" style="-moz-tab-size:4; -o-tab-size:4; -webkit-tab-size:4; tab-size:4; font-size: 12px !important; line-height: 15px !important;" wrap="soft">
          db.movie.ensureIndex({directed_by:1})
         </textarea>
        </div>
        <div class="crayon-main" style="">
         <table class="crayon-table">
          <tbody>
           <tr class="crayon-row">
            <td class="crayon-nums " data-settings="show">
             <div class="crayon-nums-content" style="font-size: 12px !important; line-height: 15px !important;">
              <div class="crayon-num" data-line="crayon-5768647c9c607784162399-1">
               1
              </div>
              <div class="crayon-num crayon-striped-num" data-line="crayon-5768647c9c607784162399-2">
               2
              </div>
             </div>
            </td>
            <td class="crayon-code">
             <div class="crayon-pre" style="font-size: 12px !important; line-height: 15px !important; -moz-tab-size:4; -o-tab-size:4; -webkit-tab-size:4; tab-size:4;">
              <div class="crayon-line" id="crayon-5768647c9c607784162399-1">
               <span class="crayon-v">
                db
               </span>
               <span class="crayon-sy">
                .
               </span>
               <span class="crayon-v">
                movie
               </span>
               <span class="crayon-sy">
                .
               </span>
               <span class="crayon-e">
                ensureIndex
               </span>
               <span class="crayon-sy">
                (
               </span>
               <span class="crayon-sy">
                {
               </span>
               <span class="crayon-v">
                directed_by
               </span>
               <span class="crayon-o">
                :
               </span>
               <span class="crayon-cn">
                1
               </span>
               <span class="crayon-sy">
                }
               </span>
               <span class="crayon-sy">
                )
               </span>
              </div>
              <div class="crayon-line crayon-striped-line" id="crayon-5768647c9c607784162399-2">
              </div>
             </div>
            </td>
           </tr>
          </tbody>
         </table>
        </div>
       </div>
       <!-- [Format Time: 0.0008 seconds] -->
       <p>
        这里的1是升序索引，如果要降序索引，用-1。
       </p>
       <p>
        MongoDB支持对输出进行排序，比如按名字排序：
       </p>
       <!-- Crayon Syntax Highlighter v_2.7.2_beta -->
       <div class="crayon-syntax crayon-theme-classic crayon-font-monaco crayon-os-pc print-yes notranslate" data-settings=" minimize scroll-mouseover" id="crayon-5768647c9c60d065077260" style=" margin-top: 12px; margin-bottom: 12px; font-size: 12px !important; line-height: 15px !important;">
        <div class="crayon-toolbar" data-settings=" mouseover overlay hide delay" style="font-size: 12px !important;height: 18px !important; line-height: 18px !important;">
         <span class="crayon-title">
         </span>
         <div class="crayon-tools" style="font-size: 12px !important;height: 18px !important; line-height: 18px !important;">
          <div class="crayon-button crayon-nums-button" title="切换是否显示行编号">
           <div class="crayon-button-icon">
           </div>
          </div>
          <div class="crayon-button crayon-plain-button" title="纯文本显示代码">
           <div class="crayon-button-icon">
           </div>
          </div>
          <div class="crayon-button crayon-wrap-button" title="切换自动换行">
           <div class="crayon-button-icon">
           </div>
          </div>
          <div class="crayon-button crayon-expand-button" title="点击展开代码">
           <div class="crayon-button-icon">
           </div>
          </div>
          <div class="crayon-button crayon-copy-button" title="复制代码">
           <div class="crayon-button-icon">
           </div>
          </div>
          <div class="crayon-button crayon-popup-button" title="在新窗口中显示代码">
           <div class="crayon-button-icon">
           </div>
          </div>
         </div>
        </div>
        <div class="crayon-info" style="min-height: 16.8px !important; line-height: 16.8px !important;">
        </div>
        <div class="crayon-plain-wrap">
         <textarea class="crayon-plain print-no" data-settings="dblclick" readonly="" style="-moz-tab-size:4; -o-tab-size:4; -webkit-tab-size:4; tab-size:4; font-size: 12px !important; line-height: 15px !important;" wrap="soft">
          db.movie.find().sort({'title':1}).pretty()
         </textarea>
        </div>
        <div class="crayon-main" style="">
         <table class="crayon-table">
          <tbody>
           <tr class="crayon-row">
            <td class="crayon-nums " data-settings="show">
             <div class="crayon-nums-content" style="font-size: 12px !important; line-height: 15px !important;">
              <div class="crayon-num" data-line="crayon-5768647c9c60d065077260-1">
               1
              </div>
              <div class="crayon-num crayon-striped-num" data-line="crayon-5768647c9c60d065077260-2">
               2
              </div>
             </div>
            </td>
            <td class="crayon-code">
             <div class="crayon-pre" style="font-size: 12px !important; line-height: 15px !important; -moz-tab-size:4; -o-tab-size:4; -webkit-tab-size:4; tab-size:4;">
              <div class="crayon-line" id="crayon-5768647c9c60d065077260-1">
               <span class="crayon-v">
                db
               </span>
               <span class="crayon-sy">
                .
               </span>
               <span class="crayon-v">
                movie
               </span>
               <span class="crayon-sy">
                .
               </span>
               <span class="crayon-e">
                find
               </span>
               <span class="crayon-sy">
                (
               </span>
               <span class="crayon-sy">
                )
               </span>
               <span class="crayon-sy">
                .
               </span>
               <span class="crayon-e">
                sort
               </span>
               <span class="crayon-sy">
                (
               </span>
               <span class="crayon-sy">
                {
               </span>
               <span class="crayon-s">
                'title'
               </span>
               <span class="crayon-o">
                :
               </span>
               <span class="crayon-cn">
                1
               </span>
               <span class="crayon-sy">
                }
               </span>
               <span class="crayon-sy">
                )
               </span>
               <span class="crayon-sy">
                .
               </span>
               <span class="crayon-e">
                pretty
               </span>
               <span class="crayon-sy">
                (
               </span>
               <span class="crayon-sy">
                )
               </span>
              </div>
              <div class="crayon-line crayon-striped-line" id="crayon-5768647c9c60d065077260-2">
              </div>
             </div>
            </td>
           </tr>
          </tbody>
         </table>
        </div>
       </div>
       <!-- [Format Time: 0.0012 seconds] -->
       <p>
        同样地，1是升序，-1是降序。默认是1。
       </p>
       <!-- Crayon Syntax Highlighter v_2.7.2_beta -->
       <div class="crayon-syntax crayon-theme-classic crayon-font-monaco crayon-os-pc print-yes notranslate" data-settings=" minimize scroll-mouseover" id="crayon-5768647c9c612701315377" style=" margin-top: 12px; margin-bottom: 12px; font-size: 12px !important; line-height: 15px !important;">
        <div class="crayon-toolbar" data-settings=" mouseover overlay hide delay" style="font-size: 12px !important;height: 18px !important; line-height: 18px !important;">
         <span class="crayon-title">
         </span>
         <div class="crayon-tools" style="font-size: 12px !important;height: 18px !important; line-height: 18px !important;">
          <div class="crayon-button crayon-nums-button" title="切换是否显示行编号">
           <div class="crayon-button-icon">
           </div>
          </div>
          <div class="crayon-button crayon-plain-button" title="纯文本显示代码">
           <div class="crayon-button-icon">
           </div>
          </div>
          <div class="crayon-button crayon-wrap-button" title="切换自动换行">
           <div class="crayon-button-icon">
           </div>
          </div>
          <div class="crayon-button crayon-expand-button" title="点击展开代码">
           <div class="crayon-button-icon">
           </div>
          </div>
          <div class="crayon-button crayon-copy-button" title="复制代码">
           <div class="crayon-button-icon">
           </div>
          </div>
          <div class="crayon-button crayon-popup-button" title="在新窗口中显示代码">
           <div class="crayon-button-icon">
           </div>
          </div>
         </div>
        </div>
        <div class="crayon-info" style="min-height: 16.8px !important; line-height: 16.8px !important;">
        </div>
        <div class="crayon-plain-wrap">
         <textarea class="crayon-plain print-no" data-settings="dblclick" readonly="" style="-moz-tab-size:4; -o-tab-size:4; -webkit-tab-size:4; tab-size:4; font-size: 12px !important; line-height: 15px !important;" wrap="soft">
          db.movie.getIndexes()
         </textarea>
        </div>
        <div class="crayon-main" style="">
         <table class="crayon-table">
          <tbody>
           <tr class="crayon-row">
            <td class="crayon-nums " data-settings="show">
             <div class="crayon-nums-content" style="font-size: 12px !important; line-height: 15px !important;">
              <div class="crayon-num" data-line="crayon-5768647c9c612701315377-1">
               1
              </div>
              <div class="crayon-num crayon-striped-num" data-line="crayon-5768647c9c612701315377-2">
               2
              </div>
             </div>
            </td>
            <td class="crayon-code">
             <div class="crayon-pre" style="font-size: 12px !important; line-height: 15px !important; -moz-tab-size:4; -o-tab-size:4; -webkit-tab-size:4; tab-size:4;">
              <div class="crayon-line" id="crayon-5768647c9c612701315377-1">
               <span class="crayon-v">
                db
               </span>
               <span class="crayon-sy">
                .
               </span>
               <span class="crayon-v">
                movie
               </span>
               <span class="crayon-sy">
                .
               </span>
               <span class="crayon-e">
                getIndexes
               </span>
               <span class="crayon-sy">
                (
               </span>
               <span class="crayon-sy">
                )
               </span>
              </div>
              <div class="crayon-line crayon-striped-line" id="crayon-5768647c9c612701315377-2">
              </div>
             </div>
            </td>
           </tr>
          </tbody>
         </table>
        </div>
       </div>
       <!-- [Format Time: 0.0008 seconds] -->
       <p>
        将返回所有索引，包括其名字。
       </p>
       <p>
        而
       </p>
       <!-- Crayon Syntax Highlighter v_2.7.2_beta -->
       <div class="crayon-syntax crayon-theme-classic crayon-font-monaco crayon-os-pc print-yes notranslate" data-settings=" minimize scroll-mouseover" id="crayon-5768647c9c618408671017" style=" margin-top: 12px; margin-bottom: 12px; font-size: 12px !important; line-height: 15px !important;">
        <div class="crayon-toolbar" data-settings=" mouseover overlay hide delay" style="font-size: 12px !important;height: 18px !important; line-height: 18px !important;">
         <span class="crayon-title">
         </span>
         <div class="crayon-tools" style="font-size: 12px !important;height: 18px !important; line-height: 18px !important;">
          <div class="crayon-button crayon-nums-button" title="切换是否显示行编号">
           <div class="crayon-button-icon">
           </div>
          </div>
          <div class="crayon-button crayon-plain-button" title="纯文本显示代码">
           <div class="crayon-button-icon">
           </div>
          </div>
          <div class="crayon-button crayon-wrap-button" title="切换自动换行">
           <div class="crayon-button-icon">
           </div>
          </div>
          <div class="crayon-button crayon-expand-button" title="点击展开代码">
           <div class="crayon-button-icon">
           </div>
          </div>
          <div class="crayon-button crayon-copy-button" title="复制代码">
           <div class="crayon-button-icon">
           </div>
          </div>
          <div class="crayon-button crayon-popup-button" title="在新窗口中显示代码">
           <div class="crayon-button-icon">
           </div>
          </div>
         </div>
        </div>
        <div class="crayon-info" style="min-height: 16.8px !important; line-height: 16.8px !important;">
        </div>
        <div class="crayon-plain-wrap">
         <textarea class="crayon-plain print-no" data-settings="dblclick" readonly="" style="-moz-tab-size:4; -o-tab-size:4; -webkit-tab-size:4; tab-size:4; font-size: 12px !important; line-height: 15px !important;" wrap="soft">
          db.movie.dropIndex('index_name')
         </textarea>
        </div>
        <div class="crayon-main" style="">
         <table class="crayon-table">
          <tbody>
           <tr class="crayon-row">
            <td class="crayon-nums " data-settings="show">
             <div class="crayon-nums-content" style="font-size: 12px !important; line-height: 15px !important;">
              <div class="crayon-num" data-line="crayon-5768647c9c618408671017-1">
               1
              </div>
              <div class="crayon-num crayon-striped-num" data-line="crayon-5768647c9c618408671017-2">
               2
              </div>
             </div>
            </td>
            <td class="crayon-code">
             <div class="crayon-pre" style="font-size: 12px !important; line-height: 15px !important; -moz-tab-size:4; -o-tab-size:4; -webkit-tab-size:4; tab-size:4;">
              <div class="crayon-line" id="crayon-5768647c9c618408671017-1">
               <span class="crayon-v">
                db
               </span>
               <span class="crayon-sy">
                .
               </span>
               <span class="crayon-v">
                movie
               </span>
               <span class="crayon-sy">
                .
               </span>
               <span class="crayon-e">
                dropIndex
               </span>
               <span class="crayon-sy">
                (
               </span>
               <span class="crayon-s">
                'index_name'
               </span>
               <span class="crayon-sy">
                )
               </span>
              </div>
              <div class="crayon-line crayon-striped-line" id="crayon-5768647c9c618408671017-2">
              </div>
             </div>
            </td>
           </tr>
          </tbody>
         </table>
        </div>
       </div>
       <!-- [Format Time: 0.0006 seconds] -->
       <p>
        将删除对应的索引。
       </p>
       <h4>
        <a class="anchor" href="https://github.com/StevenSLXie/Tutorials-for-Web-Developers/blob/master/MongoDB%20%E6%9E%81%E7%AE%80%E5%AE%9E%E8%B7%B5%E5%85%A5%E9%97%A8.md#11-%E8%81%9A%E5%90%88" id="user-content-11-聚合">
        </a>
        11. 聚合
       </h4>
       <p>
        MongoDB支持类似于SQL里面的
        <code>
         GROUP BY
        </code>
        操作。比如当有一张学生成绩的明细表时，我们可以找出每个分数段的学生各有多少。为了实现这个操作，我们需要稍加改动我们的数据库。执行以下三条命令：
       </p>
       <!-- Crayon Syntax Highlighter v_2.7.2_beta -->
       <div class="crayon-syntax crayon-theme-classic crayon-font-monaco crayon-os-pc print-yes notranslate" data-settings=" minimize scroll-mouseover" id="crayon-5768647c9c61e765838757" style=" margin-top: 12px; margin-bottom: 12px; font-size: 12px !important; line-height: 15px !important;">
        <div class="crayon-toolbar" data-settings=" mouseover overlay hide delay" style="font-size: 12px !important;height: 18px !important; line-height: 18px !important;">
         <span class="crayon-title">
         </span>
         <div class="crayon-tools" style="font-size: 12px !important;height: 18px !important; line-height: 18px !important;">
          <div class="crayon-button crayon-nums-button" title="切换是否显示行编号">
           <div class="crayon-button-icon">
           </div>
          </div>
          <div class="crayon-button crayon-plain-button" title="纯文本显示代码">
           <div class="crayon-button-icon">
           </div>
          </div>
          <div class="crayon-button crayon-wrap-button" title="切换自动换行">
           <div class="crayon-button-icon">
           </div>
          </div>
          <div class="crayon-button crayon-expand-button" title="点击展开代码">
           <div class="crayon-button-icon">
           </div>
          </div>
          <div class="crayon-button crayon-copy-button" title="复制代码">
           <div class="crayon-button-icon">
           </div>
          </div>
          <div class="crayon-button crayon-popup-button" title="在新窗口中显示代码">
           <div class="crayon-button-icon">
           </div>
          </div>
         </div>
        </div>
        <div class="crayon-info" style="min-height: 16.8px !important; line-height: 16.8px !important;">
        </div>
        <div class="crayon-plain-wrap">
         <textarea class="crayon-plain print-no" data-settings="dblclick" readonly="" style="-moz-tab-size:4; -o-tab-size:4; -webkit-tab-size:4; tab-size:4; font-size: 12px !important; line-height: 15px !important;" wrap="soft">
          db.movie.update({title:'Seven'},{$set:{grade:1}})
db.movie.update({title:'Forrest Gump'},{$set:{grade:1}})
db.movie.update({title:'Fight Club'},{$set:{grade:2}})
         </textarea>
        </div>
        <div class="crayon-main" style="">
         <table class="crayon-table">
          <tbody>
           <tr class="crayon-row">
            <td class="crayon-nums " data-settings="show">
             <div class="crayon-nums-content" style="font-size: 12px !important; line-height: 15px !important;">
              <div class="crayon-num" data-line="crayon-5768647c9c61e765838757-1">
               1
              </div>
              <div class="crayon-num crayon-striped-num" data-line="crayon-5768647c9c61e765838757-2">
               2
              </div>
              <div class="crayon-num" data-line="crayon-5768647c9c61e765838757-3">
               3
              </div>
              <div class="crayon-num crayon-striped-num" data-line="crayon-5768647c9c61e765838757-4">
               4
              </div>
             </div>
            </td>
            <td class="crayon-code">
             <div class="crayon-pre" style="font-size: 12px !important; line-height: 15px !important; -moz-tab-size:4; -o-tab-size:4; -webkit-tab-size:4; tab-size:4;">
              <div class="crayon-line" id="crayon-5768647c9c61e765838757-1">
               <span class="crayon-v">
                db
               </span>
               <span class="crayon-sy">
                .
               </span>
               <span class="crayon-v">
                movie
               </span>
               <span class="crayon-sy">
                .
               </span>
               <span class="crayon-e">
                update
               </span>
               <span class="crayon-sy">
                (
               </span>
               <span class="crayon-sy">
                {
               </span>
               <span class="crayon-v">
                title
               </span>
               <span class="crayon-o">
                :
               </span>
               <span class="crayon-s">
                'Seven'
               </span>
               <span class="crayon-sy">
                }
               </span>
               <span class="crayon-sy">
                ,
               </span>
               <span class="crayon-sy">
                {
               </span>
               <span class="crayon-sy">
                $
               </span>
               <span class="crayon-v">
                set
               </span>
               <span class="crayon-o">
                :
               </span>
               <span class="crayon-sy">
                {
               </span>
               <span class="crayon-v">
                grade
               </span>
               <span class="crayon-o">
                :
               </span>
               <span class="crayon-cn">
                1
               </span>
               <span class="crayon-sy">
                }
               </span>
               <span class="crayon-sy">
                }
               </span>
               <span class="crayon-sy">
                )
               </span>
              </div>
              <div class="crayon-line crayon-striped-line" id="crayon-5768647c9c61e765838757-2">
               <span class="crayon-v">
                db
               </span>
               <span class="crayon-sy">
                .
               </span>
               <span class="crayon-v">
                movie
               </span>
               <span class="crayon-sy">
                .
               </span>
               <span class="crayon-e">
                update
               </span>
               <span class="crayon-sy">
                (
               </span>
               <span class="crayon-sy">
                {
               </span>
               <span class="crayon-v">
                title
               </span>
               <span class="crayon-o">
                :
               </span>
               <span class="crayon-s">
                'Forrest Gump'
               </span>
               <span class="crayon-sy">
                }
               </span>
               <span class="crayon-sy">
                ,
               </span>
               <span class="crayon-sy">
                {
               </span>
               <span class="crayon-sy">
                $
               </span>
               <span class="crayon-v">
                set
               </span>
               <span class="crayon-o">
                :
               </span>
               <span class="crayon-sy">
                {
               </span>
               <span class="crayon-v">
                grade
               </span>
               <span class="crayon-o">
                :
               </span>
               <span class="crayon-cn">
                1
               </span>
               <span class="crayon-sy">
                }
               </span>
               <span class="crayon-sy">
                }
               </span>
               <span class="crayon-sy">
                )
               </span>
              </div>
              <div class="crayon-line" id="crayon-5768647c9c61e765838757-3">
               <span class="crayon-v">
                db
               </span>
               <span class="crayon-sy">
                .
               </span>
               <span class="crayon-v">
                movie
               </span>
               <span class="crayon-sy">
                .
               </span>
               <span class="crayon-e">
                update
               </span>
               <span class="crayon-sy">
                (
               </span>
               <span class="crayon-sy">
                {
               </span>
               <span class="crayon-v">
                title
               </span>
               <span class="crayon-o">
                :
               </span>
               <span class="crayon-s">
                'Fight Club'
               </span>
               <span class="crayon-sy">
                }
               </span>
               <span class="crayon-sy">
                ,
               </span>
               <span class="crayon-sy">
                {
               </span>
               <span class="crayon-sy">
                $
               </span>
               <span class="crayon-v">
                set
               </span>
               <span class="crayon-o">
                :
               </span>
               <span class="crayon-sy">
                {
               </span>
               <span class="crayon-v">
                grade
               </span>
               <span class="crayon-o">
                :
               </span>
               <span class="crayon-cn">
                2
               </span>
               <span class="crayon-sy">
                }
               </span>
               <span class="crayon-sy">
                }
               </span>
               <span class="crayon-sy">
                )
               </span>
              </div>
              <div class="crayon-line crayon-striped-line" id="crayon-5768647c9c61e765838757-4">
              </div>
             </div>
            </td>
           </tr>
          </tbody>
         </table>
        </div>
       </div>
       <!-- [Format Time: 0.0028 seconds] -->
       <p>
        这几条是给每部电影加一个虚拟的分级，前两部是归类是一级，后一部是二级。
       </p>
       <p>
        这里你也可以看到MongoDB的强大之处：可以动态地后续添加各种新项目。
       </p>
       <p>
        我们先通过聚合来找出总共有几种级别。
       </p>
       <!-- Crayon Syntax Highlighter v_2.7.2_beta -->
       <div class="crayon-syntax crayon-theme-classic crayon-font-monaco crayon-os-pc print-yes notranslate" data-settings=" minimize scroll-mouseover" id="crayon-5768647c9c624796323164" style=" margin-top: 12px; margin-bottom: 12px; font-size: 12px !important; line-height: 15px !important;">
        <div class="crayon-toolbar" data-settings=" mouseover overlay hide delay" style="font-size: 12px !important;height: 18px !important; line-height: 18px !important;">
         <span class="crayon-title">
         </span>
         <div class="crayon-tools" style="font-size: 12px !important;height: 18px !important; line-height: 18px !important;">
          <div class="crayon-button crayon-nums-button" title="切换是否显示行编号">
           <div class="crayon-button-icon">
           </div>
          </div>
          <div class="crayon-button crayon-plain-button" title="纯文本显示代码">
           <div class="crayon-button-icon">
           </div>
          </div>
          <div class="crayon-button crayon-wrap-button" title="切换自动换行">
           <div class="crayon-button-icon">
           </div>
          </div>
          <div class="crayon-button crayon-expand-button" title="点击展开代码">
           <div class="crayon-button-icon">
           </div>
          </div>
          <div class="crayon-button crayon-copy-button" title="复制代码">
           <div class="crayon-button-icon">
           </div>
          </div>
          <div class="crayon-button crayon-popup-button" title="在新窗口中显示代码">
           <div class="crayon-button-icon">
           </div>
          </div>
         </div>
        </div>
        <div class="crayon-info" style="min-height: 16.8px !important; line-height: 16.8px !important;">
        </div>
        <div class="crayon-plain-wrap">
         <textarea class="crayon-plain print-no" data-settings="dblclick" readonly="" style="-moz-tab-size:4; -o-tab-size:4; -webkit-tab-size:4; tab-size:4; font-size: 12px !important; line-height: 15px !important;" wrap="soft">
          db.movie.aggregate([{$group:{_id:'$grade'}}])
         </textarea>
        </div>
        <div class="crayon-main" style="">
         <table class="crayon-table">
          <tbody>
           <tr class="crayon-row">
            <td class="crayon-nums " data-settings="show">
             <div class="crayon-nums-content" style="font-size: 12px !important; line-height: 15px !important;">
              <div class="crayon-num" data-line="crayon-5768647c9c624796323164-1">
               1
              </div>
              <div class="crayon-num crayon-striped-num" data-line="crayon-5768647c9c624796323164-2">
               2
              </div>
             </div>
            </td>
            <td class="crayon-code">
             <div class="crayon-pre" style="font-size: 12px !important; line-height: 15px !important; -moz-tab-size:4; -o-tab-size:4; -webkit-tab-size:4; tab-size:4;">
              <div class="crayon-line" id="crayon-5768647c9c624796323164-1">
               <span class="crayon-v">
                db
               </span>
               <span class="crayon-sy">
                .
               </span>
               <span class="crayon-v">
                movie
               </span>
               <span class="crayon-sy">
                .
               </span>
               <span class="crayon-e">
                aggregate
               </span>
               <span class="crayon-sy">
                (
               </span>
               <span class="crayon-sy">
                [
               </span>
               <span class="crayon-sy">
                {
               </span>
               <span class="crayon-sy">
                $
               </span>
               <span class="crayon-v">
                group
               </span>
               <span class="crayon-o">
                :
               </span>
               <span class="crayon-sy">
                {
               </span>
               <span class="crayon-v">
                _id
               </span>
               <span class="crayon-o">
                :
               </span>
               <span class="crayon-s">
                '$grade'
               </span>
               <span class="crayon-sy">
                }
               </span>
               <span class="crayon-sy">
                }
               </span>
               <span class="crayon-sy">
                ]
               </span>
               <span class="crayon-sy">
                )
               </span>
              </div>
              <div class="crayon-line crayon-striped-line" id="crayon-5768647c9c624796323164-2">
              </div>
             </div>
            </td>
           </tr>
          </tbody>
         </table>
        </div>
       </div>
       <!-- [Format Time: 0.0010 seconds] -->
       <p>
        输出：
       </p>
       <!-- Crayon Syntax Highlighter v_2.7.2_beta -->
       <div class="crayon-syntax crayon-theme-classic crayon-font-monaco crayon-os-pc print-yes notranslate" data-settings=" minimize scroll-mouseover" id="crayon-5768647c9c629369722570" style=" margin-top: 12px; margin-bottom: 12px; font-size: 12px !important; line-height: 15px !important;">
        <div class="crayon-toolbar" data-settings=" mouseover overlay hide delay" style="font-size: 12px !important;height: 18px !important; line-height: 18px !important;">
         <span class="crayon-title">
         </span>
         <div class="crayon-tools" style="font-size: 12px !important;height: 18px !important; line-height: 18px !important;">
          <div class="crayon-button crayon-nums-button" title="切换是否显示行编号">
           <div class="crayon-button-icon">
           </div>
          </div>
          <div class="crayon-button crayon-plain-button" title="纯文本显示代码">
           <div class="crayon-button-icon">
           </div>
          </div>
          <div class="crayon-button crayon-wrap-button" title="切换自动换行">
           <div class="crayon-button-icon">
           </div>
          </div>
          <div class="crayon-button crayon-expand-button" title="点击展开代码">
           <div class="crayon-button-icon">
           </div>
          </div>
          <div class="crayon-button crayon-copy-button" title="复制代码">
           <div class="crayon-button-icon">
           </div>
          </div>
          <div class="crayon-button crayon-popup-button" title="在新窗口中显示代码">
           <div class="crayon-button-icon">
           </div>
          </div>
         </div>
        </div>
        <div class="crayon-info" style="min-height: 16.8px !important; line-height: 16.8px !important;">
        </div>
        <div class="crayon-plain-wrap">
         <textarea class="crayon-plain print-no" data-settings="dblclick" readonly="" style="-moz-tab-size:4; -o-tab-size:4; -webkit-tab-size:4; tab-size:4; font-size: 12px !important; line-height: 15px !important;" wrap="soft">
          { "_id" : 2 }
{ "_id" : 1 }
         </textarea>
        </div>
        <div class="crayon-main" style="">
         <table class="crayon-table">
          <tbody>
           <tr class="crayon-row">
            <td class="crayon-nums " data-settings="show">
             <div class="crayon-nums-content" style="font-size: 12px !important; line-height: 15px !important;">
              <div class="crayon-num" data-line="crayon-5768647c9c629369722570-1">
               1
              </div>
              <div class="crayon-num crayon-striped-num" data-line="crayon-5768647c9c629369722570-2">
               2
              </div>
              <div class="crayon-num" data-line="crayon-5768647c9c629369722570-3">
               3
              </div>
             </div>
            </td>
            <td class="crayon-code">
             <div class="crayon-pre" style="font-size: 12px !important; line-height: 15px !important; -moz-tab-size:4; -o-tab-size:4; -webkit-tab-size:4; tab-size:4;">
              <div class="crayon-line" id="crayon-5768647c9c629369722570-1">
               <span class="crayon-sy">
                {
               </span>
               <span class="crayon-h">
               </span>
               <span class="crayon-s">
                "_id"
               </span>
               <span class="crayon-h">
               </span>
               <span class="crayon-o">
                :
               </span>
               <span class="crayon-h">
               </span>
               <span class="crayon-cn">
                2
               </span>
               <span class="crayon-h">
               </span>
               <span class="crayon-sy">
                }
               </span>
              </div>
              <div class="crayon-line crayon-striped-line" id="crayon-5768647c9c629369722570-2">
               <span class="crayon-sy">
                {
               </span>
               <span class="crayon-h">
               </span>
               <span class="crayon-s">
                "_id"
               </span>
               <span class="crayon-h">
               </span>
               <span class="crayon-o">
                :
               </span>
               <span class="crayon-h">
               </span>
               <span class="crayon-cn">
                1
               </span>
               <span class="crayon-h">
               </span>
               <span class="crayon-sy">
                }
               </span>
              </div>
              <div class="crayon-line" id="crayon-5768647c9c629369722570-3">
              </div>
             </div>
            </td>
           </tr>
          </tbody>
         </table>
        </div>
       </div>
       <!-- [Format Time: 0.0009 seconds] -->
       <p>
        注意这里的2和1是指级别，而不是每个级别的电影数。这个例子看得清楚些：
       </p>
       <!-- Crayon Syntax Highlighter v_2.7.2_beta -->
       <div class="crayon-syntax crayon-theme-classic crayon-font-monaco crayon-os-pc print-yes notranslate" data-settings=" minimize scroll-mouseover" id="crayon-5768647c9c62f258280444" style=" margin-top: 12px; margin-bottom: 12px; font-size: 12px !important; line-height: 15px !important;">
        <div class="crayon-toolbar" data-settings=" mouseover overlay hide delay" style="font-size: 12px !important;height: 18px !important; line-height: 18px !important;">
         <span class="crayon-title">
         </span>
         <div class="crayon-tools" style="font-size: 12px !important;height: 18px !important; line-height: 18px !important;">
          <div class="crayon-button crayon-nums-button" title="切换是否显示行编号">
           <div class="crayon-button-icon">
           </div>
          </div>
          <div class="crayon-button crayon-plain-button" title="纯文本显示代码">
           <div class="crayon-button-icon">
           </div>
          </div>
          <div class="crayon-button crayon-wrap-button" title="切换自动换行">
           <div class="crayon-button-icon">
           </div>
          </div>
          <div class="crayon-button crayon-expand-button" title="点击展开代码">
           <div class="crayon-button-icon">
           </div>
          </div>
          <div class="crayon-button crayon-copy-button" title="复制代码">
           <div class="crayon-button-icon">
           </div>
          </div>
          <div class="crayon-button crayon-popup-button" title="在新窗口中显示代码">
           <div class="crayon-button-icon">
           </div>
          </div>
         </div>
        </div>
        <div class="crayon-info" style="min-height: 16.8px !important; line-height: 16.8px !important;">
        </div>
        <div class="crayon-plain-wrap">
         <textarea class="crayon-plain print-no" data-settings="dblclick" readonly="" style="-moz-tab-size:4; -o-tab-size:4; -webkit-tab-size:4; tab-size:4; font-size: 12px !important; line-height: 15px !important;" wrap="soft">
          db.movie.aggregate([{$group:{_id:'$directed_by'}}])
         </textarea>
        </div>
        <div class="crayon-main" style="">
         <table class="crayon-table">
          <tbody>
           <tr class="crayon-row">
            <td class="crayon-nums " data-settings="show">
             <div class="crayon-nums-content" style="font-size: 12px !important; line-height: 15px !important;">
              <div class="crayon-num" data-line="crayon-5768647c9c62f258280444-1">
               1
              </div>
              <div class="crayon-num crayon-striped-num" data-line="crayon-5768647c9c62f258280444-2">
               2
              </div>
             </div>
            </td>
            <td class="crayon-code">
             <div class="crayon-pre" style="font-size: 12px !important; line-height: 15px !important; -moz-tab-size:4; -o-tab-size:4; -webkit-tab-size:4; tab-size:4;">
              <div class="crayon-line" id="crayon-5768647c9c62f258280444-1">
               <span class="crayon-v">
                db
               </span>
               <span class="crayon-sy">
                .
               </span>
               <span class="crayon-v">
                movie
               </span>
               <span class="crayon-sy">
                .
               </span>
               <span class="crayon-e">
                aggregate
               </span>
               <span class="crayon-sy">
                (
               </span>
               <span class="crayon-sy">
                [
               </span>
               <span class="crayon-sy">
                {
               </span>
               <span class="crayon-sy">
                $
               </span>
               <span class="crayon-v">
                group
               </span>
               <span class="crayon-o">
                :
               </span>
               <span class="crayon-sy">
                {
               </span>
               <span class="crayon-v">
                _id
               </span>
               <span class="crayon-o">
                :
               </span>
               <span class="crayon-s">
                '$directed_by'
               </span>
               <span class="crayon-sy">
                }
               </span>
               <span class="crayon-sy">
                }
               </span>
               <span class="crayon-sy">
                ]
               </span>
               <span class="crayon-sy">
                )
               </span>
              </div>
              <div class="crayon-line crayon-striped-line" id="crayon-5768647c9c62f258280444-2">
              </div>
             </div>
            </td>
           </tr>
          </tbody>
         </table>
        </div>
       </div>
       <!-- [Format Time: 0.0010 seconds] -->
       <p>
        这里按照导演名字进行聚合。输出：
       </p>
       <!-- Crayon Syntax Highlighter v_2.7.2_beta -->
       <div class="crayon-syntax crayon-theme-classic crayon-font-monaco crayon-os-pc print-yes notranslate" data-settings=" minimize scroll-mouseover" id="crayon-5768647c9c635456949378" style=" margin-top: 12px; margin-bottom: 12px; font-size: 12px !important; line-height: 15px !important;">
        <div class="crayon-toolbar" data-settings=" mouseover overlay hide delay" style="font-size: 12px !important;height: 18px !important; line-height: 18px !important;">
         <span class="crayon-title">
         </span>
         <div class="crayon-tools" style="font-size: 12px !important;height: 18px !important; line-height: 18px !important;">
          <div class="crayon-button crayon-nums-button" title="切换是否显示行编号">
           <div class="crayon-button-icon">
           </div>
          </div>
          <div class="crayon-button crayon-plain-button" title="纯文本显示代码">
           <div class="crayon-button-icon">
           </div>
          </div>
          <div class="crayon-button crayon-wrap-button" title="切换自动换行">
           <div class="crayon-button-icon">
           </div>
          </div>
          <div class="crayon-button crayon-expand-button" title="点击展开代码">
           <div class="crayon-button-icon">
           </div>
          </div>
          <div class="crayon-button crayon-copy-button" title="复制代码">
           <div class="crayon-button-icon">
           </div>
          </div>
          <div class="crayon-button crayon-popup-button" title="在新窗口中显示代码">
           <div class="crayon-button-icon">
           </div>
          </div>
         </div>
        </div>
        <div class="crayon-info" style="min-height: 16.8px !important; line-height: 16.8px !important;">
        </div>
        <div class="crayon-plain-wrap">
         <textarea class="crayon-plain print-no" data-settings="dblclick" readonly="" style="-moz-tab-size:4; -o-tab-size:4; -webkit-tab-size:4; tab-size:4; font-size: 12px !important; line-height: 15px !important;" wrap="soft">
          { "_id" : "David Fincher" }
{ "_id" : "Robert Zemeckis" }
         </textarea>
        </div>
        <div class="crayon-main" style="">
         <table class="crayon-table">
          <tbody>
           <tr class="crayon-row">
            <td class="crayon-nums " data-settings="show">
             <div class="crayon-nums-content" style="font-size: 12px !important; line-height: 15px !important;">
              <div class="crayon-num" data-line="crayon-5768647c9c635456949378-1">
               1
              </div>
              <div class="crayon-num crayon-striped-num" data-line="crayon-5768647c9c635456949378-2">
               2
              </div>
              <div class="crayon-num" data-line="crayon-5768647c9c635456949378-3">
               3
              </div>
             </div>
            </td>
            <td class="crayon-code">
             <div class="crayon-pre" style="font-size: 12px !important; line-height: 15px !important; -moz-tab-size:4; -o-tab-size:4; -webkit-tab-size:4; tab-size:4;">
              <div class="crayon-line" id="crayon-5768647c9c635456949378-1">
               <span class="crayon-sy">
                {
               </span>
               <span class="crayon-h">
               </span>
               <span class="crayon-s">
                "_id"
               </span>
               <span class="crayon-h">
               </span>
               <span class="crayon-o">
                :
               </span>
               <span class="crayon-h">
               </span>
               <span class="crayon-s">
                "David Fincher"
               </span>
               <span class="crayon-h">
               </span>
               <span class="crayon-sy">
                }
               </span>
              </div>
              <div class="crayon-line crayon-striped-line" id="crayon-5768647c9c635456949378-2">
               <span class="crayon-sy">
                {
               </span>
               <span class="crayon-h">
               </span>
               <span class="crayon-s">
                "_id"
               </span>
               <span class="crayon-h">
               </span>
               <span class="crayon-o">
                :
               </span>
               <span class="crayon-h">
               </span>
               <span class="crayon-s">
                "Robert Zemeckis"
               </span>
               <span class="crayon-h">
               </span>
               <span class="crayon-sy">
                }
               </span>
              </div>
              <div class="crayon-line" id="crayon-5768647c9c635456949378-3">
              </div>
             </div>
            </td>
           </tr>
          </tbody>
         </table>
        </div>
       </div>
       <!-- [Format Time: 0.0010 seconds] -->
       <p>
        接着我们要找出，每个导演的电影数分别有多少：
       </p>
       <!-- Crayon Syntax Highlighter v_2.7.2_beta -->
       <div class="crayon-syntax crayon-theme-classic crayon-font-monaco crayon-os-pc print-yes notranslate" data-settings=" minimize scroll-mouseover" id="crayon-5768647c9c63a788450760" style=" margin-top: 12px; margin-bottom: 12px; font-size: 12px !important; line-height: 15px !important;">
        <div class="crayon-toolbar" data-settings=" mouseover overlay hide delay" style="font-size: 12px !important;height: 18px !important; line-height: 18px !important;">
         <span class="crayon-title">
         </span>
         <div class="crayon-tools" style="font-size: 12px !important;height: 18px !important; line-height: 18px !important;">
          <div class="crayon-button crayon-nums-button" title="切换是否显示行编号">
           <div class="crayon-button-icon">
           </div>
          </div>
          <div class="crayon-button crayon-plain-button" title="纯文本显示代码">
           <div class="crayon-button-icon">
           </div>
          </div>
          <div class="crayon-button crayon-wrap-button" title="切换自动换行">
           <div class="crayon-button-icon">
           </div>
          </div>
          <div class="crayon-button crayon-expand-button" title="点击展开代码">
           <div class="crayon-button-icon">
           </div>
          </div>
          <div class="crayon-button crayon-copy-button" title="复制代码">
           <div class="crayon-button-icon">
           </div>
          </div>
          <div class="crayon-button crayon-popup-button" title="在新窗口中显示代码">
           <div class="crayon-button-icon">
           </div>
          </div>
         </div>
        </div>
        <div class="crayon-info" style="min-height: 16.8px !important; line-height: 16.8px !important;">
        </div>
        <div class="crayon-plain-wrap">
         <textarea class="crayon-plain print-no" data-settings="dblclick" readonly="" style="-moz-tab-size:4; -o-tab-size:4; -webkit-tab-size:4; tab-size:4; font-size: 12px !important; line-height: 15px !important;" wrap="soft">
          db.movie.aggregate([{$group:{_id:'$directed_by',num_movie:{$sum:1}}}])
         </textarea>
        </div>
        <div class="crayon-main" style="">
         <table class="crayon-table">
          <tbody>
           <tr class="crayon-row">
            <td class="crayon-nums " data-settings="show">
             <div class="crayon-nums-content" style="font-size: 12px !important; line-height: 15px !important;">
              <div class="crayon-num" data-line="crayon-5768647c9c63a788450760-1">
               1
              </div>
              <div class="crayon-num crayon-striped-num" data-line="crayon-5768647c9c63a788450760-2">
               2
              </div>
             </div>
            </td>
            <td class="crayon-code">
             <div class="crayon-pre" style="font-size: 12px !important; line-height: 15px !important; -moz-tab-size:4; -o-tab-size:4; -webkit-tab-size:4; tab-size:4;">
              <div class="crayon-line" id="crayon-5768647c9c63a788450760-1">
               <span class="crayon-v">
                db
               </span>
               <span class="crayon-sy">
                .
               </span>
               <span class="crayon-v">
                movie
               </span>
               <span class="crayon-sy">
                .
               </span>
               <span class="crayon-e">
                aggregate
               </span>
               <span class="crayon-sy">
                (
               </span>
               <span class="crayon-sy">
                [
               </span>
               <span class="crayon-sy">
                {
               </span>
               <span class="crayon-sy">
                $
               </span>
               <span class="crayon-v">
                group
               </span>
               <span class="crayon-o">
                :
               </span>
               <span class="crayon-sy">
                {
               </span>
               <span class="crayon-v">
                _id
               </span>
               <span class="crayon-o">
                :
               </span>
               <span class="crayon-s">
                '$directed_by'
               </span>
               <span class="crayon-sy">
                ,
               </span>
               <span class="crayon-v">
                num_movie
               </span>
               <span class="crayon-o">
                :
               </span>
               <span class="crayon-sy">
                {
               </span>
               <span class="crayon-sy">
                $
               </span>
               <span class="crayon-v">
                sum
               </span>
               <span class="crayon-o">
                :
               </span>
               <span class="crayon-cn">
                1
               </span>
               <span class="crayon-sy">
                }
               </span>
               <span class="crayon-sy">
                }
               </span>
               <span class="crayon-sy">
                }
               </span>
               <span class="crayon-sy">
                ]
               </span>
               <span class="crayon-sy">
                )
               </span>
              </div>
              <div class="crayon-line crayon-striped-line" id="crayon-5768647c9c63a788450760-2">
              </div>
             </div>
            </td>
           </tr>
          </tbody>
         </table>
        </div>
       </div>
       <!-- [Format Time: 0.0012 seconds] -->
       <p>
        将会输出：
       </p>
       <!-- Crayon Syntax Highlighter v_2.7.2_beta -->
       <div class="crayon-syntax crayon-theme-classic crayon-font-monaco crayon-os-pc print-yes notranslate" data-settings=" minimize scroll-mouseover" id="crayon-5768647c9c640584740459" style=" margin-top: 12px; margin-bottom: 12px; font-size: 12px !important; line-height: 15px !important;">
        <div class="crayon-toolbar" data-settings=" mouseover overlay hide delay" style="font-size: 12px !important;height: 18px !important; line-height: 18px !important;">
         <span class="crayon-title">
         </span>
         <div class="crayon-tools" style="font-size: 12px !important;height: 18px !important; line-height: 18px !important;">
          <div class="crayon-button crayon-nums-button" title="切换是否显示行编号">
           <div class="crayon-button-icon">
           </div>
          </div>
          <div class="crayon-button crayon-plain-button" title="纯文本显示代码">
           <div class="crayon-button-icon">
           </div>
          </div>
          <div class="crayon-button crayon-wrap-button" title="切换自动换行">
           <div class="crayon-button-icon">
           </div>
          </div>
          <div class="crayon-button crayon-expand-button" title="点击展开代码">
           <div class="crayon-button-icon">
           </div>
          </div>
          <div class="crayon-button crayon-copy-button" title="复制代码">
           <div class="crayon-button-icon">
           </div>
          </div>
          <div class="crayon-button crayon-popup-button" title="在新窗口中显示代码">
           <div class="crayon-button-icon">
           </div>
          </div>
         </div>
        </div>
        <div class="crayon-info" style="min-height: 16.8px !important; line-height: 16.8px !important;">
        </div>
        <div class="crayon-plain-wrap">
         <textarea class="crayon-plain print-no" data-settings="dblclick" readonly="" style="-moz-tab-size:4; -o-tab-size:4; -webkit-tab-size:4; tab-size:4; font-size: 12px !important; line-height: 15px !important;" wrap="soft">
          { "_id" : "David Fincher", "num_movie" : 2 }
{ "_id" : "Robert Zemeckis", "num_movie" : 1 }
         </textarea>
        </div>
        <div class="crayon-main" style="">
         <table class="crayon-table">
          <tbody>
           <tr class="crayon-row">
            <td class="crayon-nums " data-settings="show">
             <div class="crayon-nums-content" style="font-size: 12px !important; line-height: 15px !important;">
              <div class="crayon-num" data-line="crayon-5768647c9c640584740459-1">
               1
              </div>
              <div class="crayon-num crayon-striped-num" data-line="crayon-5768647c9c640584740459-2">
               2
              </div>
              <div class="crayon-num" data-line="crayon-5768647c9c640584740459-3">
               3
              </div>
             </div>
            </td>
            <td class="crayon-code">
             <div class="crayon-pre" style="font-size: 12px !important; line-height: 15px !important; -moz-tab-size:4; -o-tab-size:4; -webkit-tab-size:4; tab-size:4;">
              <div class="crayon-line" id="crayon-5768647c9c640584740459-1">
               <span class="crayon-sy">
                {
               </span>
               <span class="crayon-h">
               </span>
               <span class="crayon-s">
                "_id"
               </span>
               <span class="crayon-h">
               </span>
               <span class="crayon-o">
                :
               </span>
               <span class="crayon-h">
               </span>
               <span class="crayon-s">
                "David Fincher"
               </span>
               <span class="crayon-sy">
                ,
               </span>
               <span class="crayon-h">
               </span>
               <span class="crayon-s">
                "num_movie"
               </span>
               <span class="crayon-h">
               </span>
               <span class="crayon-o">
                :
               </span>
               <span class="crayon-h">
               </span>
               <span class="crayon-cn">
                2
               </span>
               <span class="crayon-h">
               </span>
               <span class="crayon-sy">
                }
               </span>
              </div>
              <div class="crayon-line crayon-striped-line" id="crayon-5768647c9c640584740459-2">
               <span class="crayon-sy">
                {
               </span>
               <span class="crayon-h">
               </span>
               <span class="crayon-s">
                "_id"
               </span>
               <span class="crayon-h">
               </span>
               <span class="crayon-o">
                :
               </span>
               <span class="crayon-h">
               </span>
               <span class="crayon-s">
                "Robert Zemeckis"
               </span>
               <span class="crayon-sy">
                ,
               </span>
               <span class="crayon-h">
               </span>
               <span class="crayon-s">
                "num_movie"
               </span>
               <span class="crayon-h">
               </span>
               <span class="crayon-o">
                :
               </span>
               <span class="crayon-h">
               </span>
               <span class="crayon-cn">
                1
               </span>
               <span class="crayon-h">
               </span>
               <span class="crayon-sy">
                }
               </span>
              </div>
              <div class="crayon-line" id="crayon-5768647c9c640584740459-3">
              </div>
             </div>
            </td>
           </tr>
          </tbody>
         </table>
        </div>
       </div>
       <!-- [Format Time: 0.0014 seconds] -->
       <p>
        注意$sum后面的1表示只是把电影数加起来，但我们也可以统计别的数据，比如两位导演谁的赞比较多：
       </p>
       <!-- Crayon Syntax Highlighter v_2.7.2_beta -->
       <div class="crayon-syntax crayon-theme-classic crayon-font-monaco crayon-os-pc print-yes notranslate" data-settings=" minimize scroll-mouseover" id="crayon-5768647c9c645977671822" style=" margin-top: 12px; margin-bottom: 12px; font-size: 12px !important; line-height: 15px !important;">
        <div class="crayon-toolbar" data-settings=" mouseover overlay hide delay" style="font-size: 12px !important;height: 18px !important; line-height: 18px !important;">
         <span class="crayon-title">
         </span>
         <div class="crayon-tools" style="font-size: 12px !important;height: 18px !important; line-height: 18px !important;">
          <div class="crayon-button crayon-nums-button" title="切换是否显示行编号">
           <div class="crayon-button-icon">
           </div>
          </div>
          <div class="crayon-button crayon-plain-button" title="纯文本显示代码">
           <div class="crayon-button-icon">
           </div>
          </div>
          <div class="crayon-button crayon-wrap-button" title="切换自动换行">
           <div class="crayon-button-icon">
           </div>
          </div>
          <div class="crayon-button crayon-expand-button" title="点击展开代码">
           <div class="crayon-button-icon">
           </div>
          </div>
          <div class="crayon-button crayon-copy-button" title="复制代码">
           <div class="crayon-button-icon">
           </div>
          </div>
          <div class="crayon-button crayon-popup-button" title="在新窗口中显示代码">
           <div class="crayon-button-icon">
           </div>
          </div>
         </div>
        </div>
        <div class="crayon-info" style="min-height: 16.8px !important; line-height: 16.8px !important;">
        </div>
        <div class="crayon-plain-wrap">
         <textarea class="crayon-plain print-no" data-settings="dblclick" readonly="" style="-moz-tab-size:4; -o-tab-size:4; -webkit-tab-size:4; tab-size:4; font-size: 12px !important; line-height: 15px !important;" wrap="soft">
          db.movie.aggregate([{$group:{_id:'$directed_by',num_likes:{$sum:'$likes'}}}])
         </textarea>
        </div>
        <div class="crayon-main" style="">
         <table class="crayon-table">
          <tbody>
           <tr class="crayon-row">
            <td class="crayon-nums " data-settings="show">
             <div class="crayon-nums-content" style="font-size: 12px !important; line-height: 15px !important;">
              <div class="crayon-num" data-line="crayon-5768647c9c645977671822-1">
               1
              </div>
              <div class="crayon-num crayon-striped-num" data-line="crayon-5768647c9c645977671822-2">
               2
              </div>
             </div>
            </td>
            <td class="crayon-code">
             <div class="crayon-pre" style="font-size: 12px !important; line-height: 15px !important; -moz-tab-size:4; -o-tab-size:4; -webkit-tab-size:4; tab-size:4;">
              <div class="crayon-line" id="crayon-5768647c9c645977671822-1">
               <span class="crayon-h">
               </span>
               <span class="crayon-v">
                db
               </span>
               <span class="crayon-sy">
                .
               </span>
               <span class="crayon-v">
                movie
               </span>
               <span class="crayon-sy">
                .
               </span>
               <span class="crayon-e">
                aggregate
               </span>
               <span class="crayon-sy">
                (
               </span>
               <span class="crayon-sy">
                [
               </span>
               <span class="crayon-sy">
                {
               </span>
               <span class="crayon-sy">
                $
               </span>
               <span class="crayon-v">
                group
               </span>
               <span class="crayon-o">
                :
               </span>
               <span class="crayon-sy">
                {
               </span>
               <span class="crayon-v">
                _id
               </span>
               <span class="crayon-o">
                :
               </span>
               <span class="crayon-s">
                '$directed_by'
               </span>
               <span class="crayon-sy">
                ,
               </span>
               <span class="crayon-v">
                num_likes
               </span>
               <span class="crayon-o">
                :
               </span>
               <span class="crayon-sy">
                {
               </span>
               <span class="crayon-sy">
                $
               </span>
               <span class="crayon-v">
                sum
               </span>
               <span class="crayon-o">
                :
               </span>
               <span class="crayon-s">
                '$likes'
               </span>
               <span class="crayon-sy">
                }
               </span>
               <span class="crayon-sy">
                }
               </span>
               <span class="crayon-sy">
                }
               </span>
               <span class="crayon-sy">
                ]
               </span>
               <span class="crayon-sy">
                )
               </span>
              </div>
              <div class="crayon-line crayon-striped-line" id="crayon-5768647c9c645977671822-2">
              </div>
             </div>
            </td>
           </tr>
          </tbody>
         </table>
        </div>
       </div>
       <!-- [Format Time: 0.0016 seconds] -->
       <p>
        输出：
       </p>
       <!-- Crayon Syntax Highlighter v_2.7.2_beta -->
       <div class="crayon-syntax crayon-theme-classic crayon-font-monaco crayon-os-pc print-yes notranslate" data-settings=" minimize scroll-mouseover" id="crayon-5768647c9c64b919596238" style=" margin-top: 12px; margin-bottom: 12px; font-size: 12px !important; line-height: 15px !important;">
        <div class="crayon-toolbar" data-settings=" mouseover overlay hide delay" style="font-size: 12px !important;height: 18px !important; line-height: 18px !important;">
         <span class="crayon-title">
         </span>
         <div class="crayon-tools" style="font-size: 12px !important;height: 18px !important; line-height: 18px !important;">
          <div class="crayon-button crayon-nums-button" title="切换是否显示行编号">
           <div class="crayon-button-icon">
           </div>
          </div>
          <div class="crayon-button crayon-plain-button" title="纯文本显示代码">
           <div class="crayon-button-icon">
           </div>
          </div>
          <div class="crayon-button crayon-wrap-button" title="切换自动换行">
           <div class="crayon-button-icon">
           </div>
          </div>
          <div class="crayon-button crayon-expand-button" title="点击展开代码">
           <div class="crayon-button-icon">
           </div>
          </div>
          <div class="crayon-button crayon-copy-button" title="复制代码">
           <div class="crayon-button-icon">
           </div>
          </div>
          <div class="crayon-button crayon-popup-button" title="在新窗口中显示代码">
           <div class="crayon-button-icon">
           </div>
          </div>
         </div>
        </div>
        <div class="crayon-info" style="min-height: 16.8px !important; line-height: 16.8px !important;">
        </div>
        <div class="crayon-plain-wrap">
         <textarea class="crayon-plain print-no" data-settings="dblclick" readonly="" style="-moz-tab-size:4; -o-tab-size:4; -webkit-tab-size:4; tab-size:4; font-size: 12px !important; line-height: 15px !important;" wrap="soft">
          { "_id" : "David Fincher", "num_likes" : 358753 }
{ "_id" : "Robert Zemeckis", "num_likes" : 864377 }
         </textarea>
        </div>
        <div class="crayon-main" style="">
         <table class="crayon-table">
          <tbody>
           <tr class="crayon-row">
            <td class="crayon-nums " data-settings="show">
             <div class="crayon-nums-content" style="font-size: 12px !important; line-height: 15px !important;">
              <div class="crayon-num" data-line="crayon-5768647c9c64b919596238-1">
               1
              </div>
              <div class="crayon-num crayon-striped-num" data-line="crayon-5768647c9c64b919596238-2">
               2
              </div>
              <div class="crayon-num" data-line="crayon-5768647c9c64b919596238-3">
               3
              </div>
             </div>
            </td>
            <td class="crayon-code">
             <div class="crayon-pre" style="font-size: 12px !important; line-height: 15px !important; -moz-tab-size:4; -o-tab-size:4; -webkit-tab-size:4; tab-size:4;">
              <div class="crayon-line" id="crayon-5768647c9c64b919596238-1">
               <span class="crayon-sy">
                {
               </span>
               <span class="crayon-h">
               </span>
               <span class="crayon-s">
                "_id"
               </span>
               <span class="crayon-h">
               </span>
               <span class="crayon-o">
                :
               </span>
               <span class="crayon-h">
               </span>
               <span class="crayon-s">
                "David Fincher"
               </span>
               <span class="crayon-sy">
                ,
               </span>
               <span class="crayon-h">
               </span>
               <span class="crayon-s">
                "num_likes"
               </span>
               <span class="crayon-h">
               </span>
               <span class="crayon-o">
                :
               </span>
               <span class="crayon-h">
               </span>
               <span class="crayon-cn">
                358753
               </span>
               <span class="crayon-h">
               </span>
               <span class="crayon-sy">
                }
               </span>
              </div>
              <div class="crayon-line crayon-striped-line" id="crayon-5768647c9c64b919596238-2">
               <span class="crayon-sy">
                {
               </span>
               <span class="crayon-h">
               </span>
               <span class="crayon-s">
                "_id"
               </span>
               <span class="crayon-h">
               </span>
               <span class="crayon-o">
                :
               </span>
               <span class="crayon-h">
               </span>
               <span class="crayon-s">
                "Robert Zemeckis"
               </span>
               <span class="crayon-sy">
                ,
               </span>
               <span class="crayon-h">
               </span>
               <span class="crayon-s">
                "num_likes"
               </span>
               <span class="crayon-h">
               </span>
               <span class="crayon-o">
                :
               </span>
               <span class="crayon-h">
               </span>
               <span class="crayon-cn">
                864377
               </span>
               <span class="crayon-h">
               </span>
               <span class="crayon-sy">
                }
               </span>
              </div>
              <div class="crayon-line" id="crayon-5768647c9c64b919596238-3">
              </div>
             </div>
            </td>
           </tr>
          </tbody>
         </table>
        </div>
       </div>
       <!-- [Format Time: 0.0014 seconds] -->
       <p>
        注意这些数据都纯属虚构啊！
       </p>
       <p>
        除了
        <code>
         $sum
        </code>
        ，还有其它一些操作。比如：
       </p>
       <!-- Crayon Syntax Highlighter v_2.7.2_beta -->
       <div class="crayon-syntax crayon-theme-classic crayon-font-monaco crayon-os-pc print-yes notranslate" data-settings=" minimize scroll-mouseover" id="crayon-5768647c9c651954226178" style=" margin-top: 12px; margin-bottom: 12px; font-size: 12px !important; line-height: 15px !important;">
        <div class="crayon-toolbar" data-settings=" mouseover overlay hide delay" style="font-size: 12px !important;height: 18px !important; line-height: 18px !important;">
         <span class="crayon-title">
         </span>
         <div class="crayon-tools" style="font-size: 12px !important;height: 18px !important; line-height: 18px !important;">
          <div class="crayon-button crayon-nums-button" title="切换是否显示行编号">
           <div class="crayon-button-icon">
           </div>
          </div>
          <div class="crayon-button crayon-plain-button" title="纯文本显示代码">
           <div class="crayon-button-icon">
           </div>
          </div>
          <div class="crayon-button crayon-wrap-button" title="切换自动换行">
           <div class="crayon-button-icon">
           </div>
          </div>
          <div class="crayon-button crayon-expand-button" title="点击展开代码">
           <div class="crayon-button-icon">
           </div>
          </div>
          <div class="crayon-button crayon-copy-button" title="复制代码">
           <div class="crayon-button-icon">
           </div>
          </div>
          <div class="crayon-button crayon-popup-button" title="在新窗口中显示代码">
           <div class="crayon-button-icon">
           </div>
          </div>
         </div>
        </div>
        <div class="crayon-info" style="min-height: 16.8px !important; line-height: 16.8px !important;">
        </div>
        <div class="crayon-plain-wrap">
         <textarea class="crayon-plain print-no" data-settings="dblclick" readonly="" style="-moz-tab-size:4; -o-tab-size:4; -webkit-tab-size:4; tab-size:4; font-size: 12px !important; line-height: 15px !important;" wrap="soft">
          db.movie.aggregate([{$group:{_id:'$directed_by',num_movie:{$avg:'$likes'}}}])
         </textarea>
        </div>
        <div class="crayon-main" style="">
         <table class="crayon-table">
          <tbody>
           <tr class="crayon-row">
            <td class="crayon-nums " data-settings="show">
             <div class="crayon-nums-content" style="font-size: 12px !important; line-height: 15px !important;">
              <div class="crayon-num" data-line="crayon-5768647c9c651954226178-1">
               1
              </div>
              <div class="crayon-num crayon-striped-num" data-line="crayon-5768647c9c651954226178-2">
               2
              </div>
             </div>
            </td>
            <td class="crayon-code">
             <div class="crayon-pre" style="font-size: 12px !important; line-height: 15px !important; -moz-tab-size:4; -o-tab-size:4; -webkit-tab-size:4; tab-size:4;">
              <div class="crayon-line" id="crayon-5768647c9c651954226178-1">
               <span class="crayon-v">
                db
               </span>
               <span class="crayon-sy">
                .
               </span>
               <span class="crayon-v">
                movie
               </span>
               <span class="crayon-sy">
                .
               </span>
               <span class="crayon-e">
                aggregate
               </span>
               <span class="crayon-sy">
                (
               </span>
               <span class="crayon-sy">
                [
               </span>
               <span class="crayon-sy">
                {
               </span>
               <span class="crayon-sy">
                $
               </span>
               <span class="crayon-v">
                group
               </span>
               <span class="crayon-o">
                :
               </span>
               <span class="crayon-sy">
                {
               </span>
               <span class="crayon-v">
                _id
               </span>
               <span class="crayon-o">
                :
               </span>
               <span class="crayon-s">
                '$directed_by'
               </span>
               <span class="crayon-sy">
                ,
               </span>
               <span class="crayon-v">
                num_movie
               </span>
               <span class="crayon-o">
                :
               </span>
               <span class="crayon-sy">
                {
               </span>
               <span class="crayon-sy">
                $
               </span>
               <span class="crayon-v">
                avg
               </span>
               <span class="crayon-o">
                :
               </span>
               <span class="crayon-s">
                '$likes'
               </span>
               <span class="crayon-sy">
                }
               </span>
               <span class="crayon-sy">
                }
               </span>
               <span class="crayon-sy">
                }
               </span>
               <span class="crayon-sy">
                ]
               </span>
               <span class="crayon-sy">
                )
               </span>
              </div>
              <div class="crayon-line crayon-striped-line" id="crayon-5768647c9c651954226178-2">
              </div>
             </div>
            </td>
           </tr>
          </tbody>
         </table>
        </div>
       </div>
       <!-- [Format Time: 0.0013 seconds] -->
       <p>
        统计平均的赞。
       </p>
       <!-- Crayon Syntax Highlighter v_2.7.2_beta -->
       <div class="crayon-syntax crayon-theme-classic crayon-font-monaco crayon-os-pc print-yes notranslate" data-settings=" minimize scroll-mouseover" id="crayon-5768647c9c656290782181" style=" margin-top: 12px; margin-bottom: 12px; font-size: 12px !important; line-height: 15px !important;">
        <div class="crayon-toolbar" data-settings=" mouseover overlay hide delay" style="font-size: 12px !important;height: 18px !important; line-height: 18px !important;">
         <span class="crayon-title">
         </span>
         <div class="crayon-tools" style="font-size: 12px !important;height: 18px !important; line-height: 18px !important;">
          <div class="crayon-button crayon-nums-button" title="切换是否显示行编号">
           <div class="crayon-button-icon">
           </div>
          </div>
          <div class="crayon-button crayon-plain-button" title="纯文本显示代码">
           <div class="crayon-button-icon">
           </div>
          </div>
          <div class="crayon-button crayon-wrap-button" title="切换自动换行">
           <div class="crayon-button-icon">
           </div>
          </div>
          <div class="crayon-button crayon-expand-button" title="点击展开代码">
           <div class="crayon-button-icon">
           </div>
          </div>
          <div class="crayon-button crayon-copy-button" title="复制代码">
           <div class="crayon-button-icon">
           </div>
          </div>
          <div class="crayon-button crayon-popup-button" title="在新窗口中显示代码">
           <div class="crayon-button-icon">
           </div>
          </div>
         </div>
        </div>
        <div class="crayon-info" style="min-height: 16.8px !important; line-height: 16.8px !important;">
        </div>
        <div class="crayon-plain-wrap">
         <textarea class="crayon-plain print-no" data-settings="dblclick" readonly="" style="-moz-tab-size:4; -o-tab-size:4; -webkit-tab-size:4; tab-size:4; font-size: 12px !important; line-height: 15px !important;" wrap="soft">
          db.movie.aggregate([{$group:{_id:'$directed_by',num_movie:{$first:'$likes'}}}]
         </textarea>
        </div>
        <div class="crayon-main" style="">
         <table class="crayon-table">
          <tbody>
           <tr class="crayon-row">
            <td class="crayon-nums " data-settings="show">
             <div class="crayon-nums-content" style="font-size: 12px !important; line-height: 15px !important;">
              <div class="crayon-num" data-line="crayon-5768647c9c656290782181-1">
               1
              </div>
              <div class="crayon-num crayon-striped-num" data-line="crayon-5768647c9c656290782181-2">
               2
              </div>
             </div>
            </td>
            <td class="crayon-code">
             <div class="crayon-pre" style="font-size: 12px !important; line-height: 15px !important; -moz-tab-size:4; -o-tab-size:4; -webkit-tab-size:4; tab-size:4;">
              <div class="crayon-line" id="crayon-5768647c9c656290782181-1">
               <span class="crayon-v">
                db
               </span>
               <span class="crayon-sy">
                .
               </span>
               <span class="crayon-v">
                movie
               </span>
               <span class="crayon-sy">
                .
               </span>
               <span class="crayon-v">
                aggregate
               </span>
               <span class="crayon-sy">
                (
               </span>
               <span class="crayon-sy">
                [
               </span>
               <span class="crayon-sy">
                {
               </span>
               <span class="crayon-sy">
                $
               </span>
               <span class="crayon-v">
                group
               </span>
               <span class="crayon-o">
                :
               </span>
               <span class="crayon-sy">
                {
               </span>
               <span class="crayon-v">
                _id
               </span>
               <span class="crayon-o">
                :
               </span>
               <span class="crayon-s">
                '$directed_by'
               </span>
               <span class="crayon-sy">
                ,
               </span>
               <span class="crayon-v">
                num_movie
               </span>
               <span class="crayon-o">
                :
               </span>
               <span class="crayon-sy">
                {
               </span>
               <span class="crayon-sy">
                $
               </span>
               <span class="crayon-v">
                first
               </span>
               <span class="crayon-o">
                :
               </span>
               <span class="crayon-s">
                '$likes'
               </span>
               <span class="crayon-sy">
                }
               </span>
               <span class="crayon-sy">
                }
               </span>
               <span class="crayon-sy">
                }
               </span>
               <span class="crayon-sy">
                ]
               </span>
              </div>
              <div class="crayon-line crayon-striped-line" id="crayon-5768647c9c656290782181-2">
              </div>
             </div>
            </td>
           </tr>
          </tbody>
         </table>
        </div>
       </div>
       <!-- [Format Time: 0.0013 seconds] -->
       <p>
        返回每个导演的电影中的第一部的赞数。
       </p>
       <p>
        其它各种操作可以参考：
        <a href="http://docs.mongodb.org/manual/reference/operator/aggregation/group/">
         http://docs.mongodb.org/manual/reference/operator/aggregation/group/
        </a>
        。
       </p>
       <h4>
        <a class="anchor" href="https://github.com/StevenSLXie/Tutorials-for-Web-Developers/blob/master/MongoDB%20%E6%9E%81%E7%AE%80%E5%AE%9E%E8%B7%B5%E5%85%A5%E9%97%A8.md#12-all-or-nothing" id="user-content-12-all-or-nothing">
        </a>
        12. All or Nothing?
       </h4>
       <p>
        MongoDB支持单个文件内的原子化操作(atomic operation)，这是说，可以将多条关于同一个文件的指令放到一起，他们要么一起执行，要么都不执行。而不会执行到一半。有些场合需要确保多条执行一起顺次执行。比如一个场景：一个电商网站，用户查询某种商品的剩余数量，以及用户购买该种商品，这两个操作，必须放在一起执行。不然的话，假定我们先执行剩余数量的查询，这是假定为1，用户接着购买，但假如这两个操作之间还加入了其它操作，比如另一个用户抢先购买了，那么原先购买用户的购买的行为就会造成数据库的错误，因为实际上这种商品以及没有存货了。但因为查询剩余数量和购买不是在一个“原子化操作”之内，因此会发生这样的错误
        <a href="http://www.tutorialspoint.com/mongodb/mongodb_atomic_operations.htm">
         [2]
        </a>
        。
       </p>
       <p>
        MongoDB提供了
        <code>
         findAndModify
        </code>
        的方法来确保atomic operation。比如这样的：
       </p>
       <!-- Crayon Syntax Highlighter v_2.7.2_beta -->
       <div class="crayon-syntax crayon-theme-classic crayon-font-monaco crayon-os-pc print-yes notranslate" data-settings=" minimize scroll-mouseover" id="crayon-5768647c9c65d688709852" style=" margin-top: 12px; margin-bottom: 12px; font-size: 12px !important; line-height: 15px !important;">
        <div class="crayon-toolbar" data-settings=" mouseover overlay hide delay" style="font-size: 12px !important;height: 18px !important; line-height: 18px !important;">
         <span class="crayon-title">
         </span>
         <div class="crayon-tools" style="font-size: 12px !important;height: 18px !important; line-height: 18px !important;">
          <div class="crayon-button crayon-nums-button" title="切换是否显示行编号">
           <div class="crayon-button-icon">
           </div>
          </div>
          <div class="crayon-button crayon-plain-button" title="纯文本显示代码">
           <div class="crayon-button-icon">
           </div>
          </div>
          <div class="crayon-button crayon-wrap-button" title="切换自动换行">
           <div class="crayon-button-icon">
           </div>
          </div>
          <div class="crayon-button crayon-expand-button" title="点击展开代码">
           <div class="crayon-button-icon">
           </div>
          </div>
          <div class="crayon-button crayon-copy-button" title="复制代码">
           <div class="crayon-button-icon">
           </div>
          </div>
          <div class="crayon-button crayon-popup-button" title="在新窗口中显示代码">
           <div class="crayon-button-icon">
           </div>
          </div>
         </div>
        </div>
        <div class="crayon-info" style="min-height: 16.8px !important; line-height: 16.8px !important;">
        </div>
        <div class="crayon-plain-wrap">
         <textarea class="crayon-plain print-no" data-settings="dblclick" readonly="" style="-moz-tab-size:4; -o-tab-size:4; -webkit-tab-size:4; tab-size:4; font-size: 12px !important; line-height: 15px !important;" wrap="soft">
          db.movie.findAndModify(
            {
            query:{'title':'Forrest Gump'},
            update:{$inc:{likes:10}}
            }
              )
         </textarea>
        </div>
        <div class="crayon-main" style="">
         <table class="crayon-table">
          <tbody>
           <tr class="crayon-row">
            <td class="crayon-nums " data-settings="show">
             <div class="crayon-nums-content" style="font-size: 12px !important; line-height: 15px !important;">
              <div class="crayon-num" data-line="crayon-5768647c9c65d688709852-1">
               1
              </div>
              <div class="crayon-num crayon-striped-num" data-line="crayon-5768647c9c65d688709852-2">
               2
              </div>
              <div class="crayon-num" data-line="crayon-5768647c9c65d688709852-3">
               3
              </div>
              <div class="crayon-num crayon-striped-num" data-line="crayon-5768647c9c65d688709852-4">
               4
              </div>
              <div class="crayon-num" data-line="crayon-5768647c9c65d688709852-5">
               5
              </div>
              <div class="crayon-num crayon-striped-num" data-line="crayon-5768647c9c65d688709852-6">
               6
              </div>
              <div class="crayon-num" data-line="crayon-5768647c9c65d688709852-7">
               7
              </div>
              <div class="crayon-num crayon-striped-num" data-line="crayon-5768647c9c65d688709852-8">
               8
              </div>
             </div>
            </td>
            <td class="crayon-code">
             <div class="crayon-pre" style="font-size: 12px !important; line-height: 15px !important; -moz-tab-size:4; -o-tab-size:4; -webkit-tab-size:4; tab-size:4;">
              <div class="crayon-line" id="crayon-5768647c9c65d688709852-1">
               <span class="crayon-v">
                db
               </span>
               <span class="crayon-sy">
                .
               </span>
               <span class="crayon-v">
                movie
               </span>
               <span class="crayon-sy">
                .
               </span>
               <span class="crayon-e">
                findAndModify
               </span>
               <span class="crayon-sy">
                (
               </span>
              </div>
              <div class="crayon-line crayon-striped-line" id="crayon-5768647c9c65d688709852-2">
               <span class="crayon-h">
               </span>
               <span class="crayon-sy">
                {
               </span>
              </div>
              <div class="crayon-line" id="crayon-5768647c9c65d688709852-3">
               <span class="crayon-h">
               </span>
               <span class="crayon-v">
                query
               </span>
               <span class="crayon-o">
                :
               </span>
               <span class="crayon-sy">
                {
               </span>
               <span class="crayon-s">
                'title'
               </span>
               <span class="crayon-o">
                :
               </span>
               <span class="crayon-s">
                'Forrest Gump'
               </span>
               <span class="crayon-sy">
                }
               </span>
               <span class="crayon-sy">
                ,
               </span>
              </div>
              <div class="crayon-line crayon-striped-line" id="crayon-5768647c9c65d688709852-4">
               <span class="crayon-h">
               </span>
               <span class="crayon-v">
                update
               </span>
               <span class="crayon-o">
                :
               </span>
               <span class="crayon-sy">
                {
               </span>
               <span class="crayon-sy">
                $
               </span>
               <span class="crayon-v">
                inc
               </span>
               <span class="crayon-o">
                :
               </span>
               <span class="crayon-sy">
                {
               </span>
               <span class="crayon-v">
                likes
               </span>
               <span class="crayon-o">
                :
               </span>
               <span class="crayon-cn">
                10
               </span>
               <span class="crayon-sy">
                }
               </span>
               <span class="crayon-sy">
                }
               </span>
              </div>
              <div class="crayon-line" id="crayon-5768647c9c65d688709852-5">
               <span class="crayon-h">
               </span>
               <span class="crayon-sy">
                }
               </span>
              </div>
              <div class="crayon-line crayon-striped-line" id="crayon-5768647c9c65d688709852-6">
               <span class="crayon-h">
               </span>
               <span class="crayon-sy">
                )
               </span>
              </div>
              <div class="crayon-line" id="crayon-5768647c9c65d688709852-7">
              </div>
              <div class="crayon-line crayon-striped-line" id="crayon-5768647c9c65d688709852-8">
              </div>
             </div>
            </td>
           </tr>
          </tbody>
         </table>
        </div>
       </div>
       <!-- [Format Time: 0.0016 seconds] -->
       <p>
        query是查找出匹配的文件，和find是一样的，而update则是更新likes这个项目。注意由于MongoDB只支持单个文件的atomic operation，因此如果query出多于一个文件，则只会对第一个文件进行操作。
       </p>
       <p>
        <code>
         findAndModify
        </code>
        还支持更多的操作，具体见：
        <a href="http://docs.mongodb.org/manual/reference/command/findAndModify/%E3%80%82">
         http://docs.mongodb.org/manual/reference/command/findAndModify/。
        </a>
       </p>
       <h4>
        <a class="anchor" href="https://github.com/StevenSLXie/Tutorials-for-Web-Developers/blob/master/MongoDB%20%E6%9E%81%E7%AE%80%E5%AE%9E%E8%B7%B5%E5%85%A5%E9%97%A8.md#13-%E6%96%87%E6%9C%AC%E6%90%9C%E7%B4%A2" id="user-content-13-文本搜索">
        </a>
        13. 文本搜索
       </h4>
       <p>
        除了前面介绍的各种深度查询功能，MongoDB还支持文本搜索。对文本搜索之前，我们需要先对要搜索的key建立一个text索引。假定我们要对标题进行文本搜索，我们可以先这样：
       </p>
       <!-- Crayon Syntax Highlighter v_2.7.2_beta -->
       <div class="crayon-syntax crayon-theme-classic crayon-font-monaco crayon-os-pc print-yes notranslate" data-settings=" minimize scroll-mouseover" id="crayon-5768647c9c664600559256" style=" margin-top: 12px; margin-bottom: 12px; font-size: 12px !important; line-height: 15px !important;">
        <div class="crayon-toolbar" data-settings=" mouseover overlay hide delay" style="font-size: 12px !important;height: 18px !important; line-height: 18px !important;">
         <span class="crayon-title">
         </span>
         <div class="crayon-tools" style="font-size: 12px !important;height: 18px !important; line-height: 18px !important;">
          <div class="crayon-button crayon-nums-button" title="切换是否显示行编号">
           <div class="crayon-button-icon">
           </div>
          </div>
          <div class="crayon-button crayon-plain-button" title="纯文本显示代码">
           <div class="crayon-button-icon">
           </div>
          </div>
          <div class="crayon-button crayon-wrap-button" title="切换自动换行">
           <div class="crayon-button-icon">
           </div>
          </div>
          <div class="crayon-button crayon-expand-button" title="点击展开代码">
           <div class="crayon-button-icon">
           </div>
          </div>
          <div class="crayon-button crayon-copy-button" title="复制代码">
           <div class="crayon-button-icon">
           </div>
          </div>
          <div class="crayon-button crayon-popup-button" title="在新窗口中显示代码">
           <div class="crayon-button-icon">
           </div>
          </div>
         </div>
        </div>
        <div class="crayon-info" style="min-height: 16.8px !important; line-height: 16.8px !important;">
        </div>
        <div class="crayon-plain-wrap">
         <textarea class="crayon-plain print-no" data-settings="dblclick" readonly="" style="-moz-tab-size:4; -o-tab-size:4; -webkit-tab-size:4; tab-size:4; font-size: 12px !important; line-height: 15px !important;" wrap="soft">
          db,movie.ensureIndex({title:'text'})
         </textarea>
        </div>
        <div class="crayon-main" style="">
         <table class="crayon-table">
          <tbody>
           <tr class="crayon-row">
            <td class="crayon-nums " data-settings="show">
             <div class="crayon-nums-content" style="font-size: 12px !important; line-height: 15px !important;">
              <div class="crayon-num" data-line="crayon-5768647c9c664600559256-1">
               1
              </div>
              <div class="crayon-num crayon-striped-num" data-line="crayon-5768647c9c664600559256-2">
               2
              </div>
             </div>
            </td>
            <td class="crayon-code">
             <div class="crayon-pre" style="font-size: 12px !important; line-height: 15px !important; -moz-tab-size:4; -o-tab-size:4; -webkit-tab-size:4; tab-size:4;">
              <div class="crayon-line" id="crayon-5768647c9c664600559256-1">
               <span class="crayon-v">
                db
               </span>
               <span class="crayon-sy">
                ,
               </span>
               <span class="crayon-v">
                movie
               </span>
               <span class="crayon-sy">
                .
               </span>
               <span class="crayon-e">
                ensureIndex
               </span>
               <span class="crayon-sy">
                (
               </span>
               <span class="crayon-sy">
                {
               </span>
               <span class="crayon-v">
                title
               </span>
               <span class="crayon-o">
                :
               </span>
               <span class="crayon-s">
                'text'
               </span>
               <span class="crayon-sy">
                }
               </span>
               <span class="crayon-sy">
                )
               </span>
              </div>
              <div class="crayon-line crayon-striped-line" id="crayon-5768647c9c664600559256-2">
              </div>
             </div>
            </td>
           </tr>
          </tbody>
         </table>
        </div>
       </div>
       <!-- [Format Time: 0.0008 seconds] -->
       <p>
        接着我们就可以对标题进行文本搜索了，比如，查找带有”Gump”的标题：
       </p>
       <!-- Crayon Syntax Highlighter v_2.7.2_beta -->
       <div class="crayon-syntax crayon-theme-classic crayon-font-monaco crayon-os-pc print-yes notranslate" data-settings=" minimize scroll-mouseover" id="crayon-5768647c9c669927832196" style=" margin-top: 12px; margin-bottom: 12px; font-size: 12px !important; line-height: 15px !important;">
        <div class="crayon-toolbar" data-settings=" mouseover overlay hide delay" style="font-size: 12px !important;height: 18px !important; line-height: 18px !important;">
         <span class="crayon-title">
         </span>
         <div class="crayon-tools" style="font-size: 12px !important;height: 18px !important; line-height: 18px !important;">
          <div class="crayon-button crayon-nums-button" title="切换是否显示行编号">
           <div class="crayon-button-icon">
           </div>
          </div>
          <div class="crayon-button crayon-plain-button" title="纯文本显示代码">
           <div class="crayon-button-icon">
           </div>
          </div>
          <div class="crayon-button crayon-wrap-button" title="切换自动换行">
           <div class="crayon-button-icon">
           </div>
          </div>
          <div class="crayon-button crayon-expand-button" title="点击展开代码">
           <div class="crayon-button-icon">
           </div>
          </div>
          <div class="crayon-button crayon-copy-button" title="复制代码">
           <div class="crayon-button-icon">
           </div>
          </div>
          <div class="crayon-button crayon-popup-button" title="在新窗口中显示代码">
           <div class="crayon-button-icon">
           </div>
          </div>
         </div>
        </div>
        <div class="crayon-info" style="min-height: 16.8px !important; line-height: 16.8px !important;">
        </div>
        <div class="crayon-plain-wrap">
         <textarea class="crayon-plain print-no" data-settings="dblclick" readonly="" style="-moz-tab-size:4; -o-tab-size:4; -webkit-tab-size:4; tab-size:4; font-size: 12px !important; line-height: 15px !important;" wrap="soft">
          db.movie.find({$text:{$search:"Gump"}}).pretty()
         </textarea>
        </div>
        <div class="crayon-main" style="">
         <table class="crayon-table">
          <tbody>
           <tr class="crayon-row">
            <td class="crayon-nums " data-settings="show">
             <div class="crayon-nums-content" style="font-size: 12px !important; line-height: 15px !important;">
              <div class="crayon-num" data-line="crayon-5768647c9c669927832196-1">
               1
              </div>
              <div class="crayon-num crayon-striped-num" data-line="crayon-5768647c9c669927832196-2">
               2
              </div>
             </div>
            </td>
            <td class="crayon-code">
             <div class="crayon-pre" style="font-size: 12px !important; line-height: 15px !important; -moz-tab-size:4; -o-tab-size:4; -webkit-tab-size:4; tab-size:4;">
              <div class="crayon-line" id="crayon-5768647c9c669927832196-1">
               <span class="crayon-v">
                db
               </span>
               <span class="crayon-sy">
                .
               </span>
               <span class="crayon-v">
                movie
               </span>
               <span class="crayon-sy">
                .
               </span>
               <span class="crayon-e">
                find
               </span>
               <span class="crayon-sy">
                (
               </span>
               <span class="crayon-sy">
                {
               </span>
               <span class="crayon-sy">
                $
               </span>
               <span class="crayon-v">
                text
               </span>
               <span class="crayon-o">
                :
               </span>
               <span class="crayon-sy">
                {
               </span>
               <span class="crayon-sy">
                $
               </span>
               <span class="crayon-v">
                search
               </span>
               <span class="crayon-o">
                :
               </span>
               <span class="crayon-s">
                "Gump"
               </span>
               <span class="crayon-sy">
                }
               </span>
               <span class="crayon-sy">
                }
               </span>
               <span class="crayon-sy">
                )
               </span>
               <span class="crayon-sy">
                .
               </span>
               <span class="crayon-e">
                pretty
               </span>
               <span class="crayon-sy">
                (
               </span>
               <span class="crayon-sy">
                )
               </span>
              </div>
              <div class="crayon-line crayon-striped-line" id="crayon-5768647c9c669927832196-2">
              </div>
             </div>
            </td>
           </tr>
          </tbody>
         </table>
        </div>
       </div>
       <!-- [Format Time: 0.0011 seconds] -->
       <p>
        注意text和search前面的$符号。
       </p>
       <p>
        这个例子里，文本搜索作用不是非常明显。但假设我们要搜索的key是一个长长的文档，这种text search的方便性就显现出来了。MongoDB目前支持15种语言的文本搜索。
       </p>
       <h4>
        <a class="anchor" href="https://github.com/StevenSLXie/Tutorials-for-Web-Developers/blob/master/MongoDB%20%E6%9E%81%E7%AE%80%E5%AE%9E%E8%B7%B5%E5%85%A5%E9%97%A8.md#14-%E6%AD%A3%E5%88%99%E8%A1%A8%E8%BE%BE%E5%BC%8F" id="user-content-14-正则表达式">
        </a>
        14. 正则表达式
       </h4>
       <p>
        MongoDB还支持基于正则表达式的查询。如果不知道正则表达式是什么，可以参考
        <a href="http://en.wikipedia.org/wiki/Regular_expression">
         Wikipedia
        </a>
        。这里简单举几个例子。比如，查找标题以
        <code>
         b
        </code>
        结尾的电影信息：
       </p>
       <!-- Crayon Syntax Highlighter v_2.7.2_beta -->
       <div class="crayon-syntax crayon-theme-classic crayon-font-monaco crayon-os-pc print-yes notranslate" data-settings=" minimize scroll-mouseover" id="crayon-5768647c9c670289334845" style=" margin-top: 12px; margin-bottom: 12px; font-size: 12px !important; line-height: 15px !important;">
        <div class="crayon-toolbar" data-settings=" mouseover overlay hide delay" style="font-size: 12px !important;height: 18px !important; line-height: 18px !important;">
         <span class="crayon-title">
         </span>
         <div class="crayon-tools" style="font-size: 12px !important;height: 18px !important; line-height: 18px !important;">
          <div class="crayon-button crayon-nums-button" title="切换是否显示行编号">
           <div class="crayon-button-icon">
           </div>
          </div>
          <div class="crayon-button crayon-plain-button" title="纯文本显示代码">
           <div class="crayon-button-icon">
           </div>
          </div>
          <div class="crayon-button crayon-wrap-button" title="切换自动换行">
           <div class="crayon-button-icon">
           </div>
          </div>
          <div class="crayon-button crayon-expand-button" title="点击展开代码">
           <div class="crayon-button-icon">
           </div>
          </div>
          <div class="crayon-button crayon-copy-button" title="复制代码">
           <div class="crayon-button-icon">
           </div>
          </div>
          <div class="crayon-button crayon-popup-button" title="在新窗口中显示代码">
           <div class="crayon-button-icon">
           </div>
          </div>
         </div>
        </div>
        <div class="crayon-info" style="min-height: 16.8px !important; line-height: 16.8px !important;">
        </div>
        <div class="crayon-plain-wrap">
         <textarea class="crayon-plain print-no" data-settings="dblclick" readonly="" style="-moz-tab-size:4; -o-tab-size:4; -webkit-tab-size:4; tab-size:4; font-size: 12px !important; line-height: 15px !important;" wrap="soft">
          db.movie.find({title:{$regex:'.*b$'}}).pretty()
         </textarea>
        </div>
        <div class="crayon-main" style="">
         <table class="crayon-table">
          <tbody>
           <tr class="crayon-row">
            <td class="crayon-nums " data-settings="show">
             <div class="crayon-nums-content" style="font-size: 12px !important; line-height: 15px !important;">
              <div class="crayon-num" data-line="crayon-5768647c9c670289334845-1">
               1
              </div>
              <div class="crayon-num crayon-striped-num" data-line="crayon-5768647c9c670289334845-2">
               2
              </div>
             </div>
            </td>
            <td class="crayon-code">
             <div class="crayon-pre" style="font-size: 12px !important; line-height: 15px !important; -moz-tab-size:4; -o-tab-size:4; -webkit-tab-size:4; tab-size:4;">
              <div class="crayon-line" id="crayon-5768647c9c670289334845-1">
               <span class="crayon-v">
                db
               </span>
               <span class="crayon-sy">
                .
               </span>
               <span class="crayon-v">
                movie
               </span>
               <span class="crayon-sy">
                .
               </span>
               <span class="crayon-e">
                find
               </span>
               <span class="crayon-sy">
                (
               </span>
               <span class="crayon-sy">
                {
               </span>
               <span class="crayon-v">
                title
               </span>
               <span class="crayon-o">
                :
               </span>
               <span class="crayon-sy">
                {
               </span>
               <span class="crayon-sy">
                $
               </span>
               <span class="crayon-v">
                regex
               </span>
               <span class="crayon-o">
                :
               </span>
               <span class="crayon-s">
                '.*b$'
               </span>
               <span class="crayon-sy">
                }
               </span>
               <span class="crayon-sy">
                }
               </span>
               <span class="crayon-sy">
                )
               </span>
               <span class="crayon-sy">
                .
               </span>
               <span class="crayon-e">
                pretty
               </span>
               <span class="crayon-sy">
                (
               </span>
               <span class="crayon-sy">
                )
               </span>
              </div>
              <div class="crayon-line crayon-striped-line" id="crayon-5768647c9c670289334845-2">
              </div>
             </div>
            </td>
           </tr>
          </tbody>
         </table>
        </div>
       </div>
       <!-- [Format Time: 0.0014 seconds] -->
       <p>
        也可以写成：
       </p>
       <!-- Crayon Syntax Highlighter v_2.7.2_beta -->
       <div class="crayon-syntax crayon-theme-classic crayon-font-monaco crayon-os-pc print-yes notranslate" data-settings=" minimize scroll-mouseover" id="crayon-5768647c9c675076354095" style=" margin-top: 12px; margin-bottom: 12px; font-size: 12px !important; line-height: 15px !important;">
        <div class="crayon-toolbar" data-settings=" mouseover overlay hide delay" style="font-size: 12px !important;height: 18px !important; line-height: 18px !important;">
         <span class="crayon-title">
         </span>
         <div class="crayon-tools" style="font-size: 12px !important;height: 18px !important; line-height: 18px !important;">
          <div class="crayon-button crayon-nums-button" title="切换是否显示行编号">
           <div class="crayon-button-icon">
           </div>
          </div>
          <div class="crayon-button crayon-plain-button" title="纯文本显示代码">
           <div class="crayon-button-icon">
           </div>
          </div>
          <div class="crayon-button crayon-wrap-button" title="切换自动换行">
           <div class="crayon-button-icon">
           </div>
          </div>
          <div class="crayon-button crayon-expand-button" title="点击展开代码">
           <div class="crayon-button-icon">
           </div>
          </div>
          <div class="crayon-button crayon-copy-button" title="复制代码">
           <div class="crayon-button-icon">
           </div>
          </div>
          <div class="crayon-button crayon-popup-button" title="在新窗口中显示代码">
           <div class="crayon-button-icon">
           </div>
          </div>
         </div>
        </div>
        <div class="crayon-info" style="min-height: 16.8px !important; line-height: 16.8px !important;">
        </div>
        <div class="crayon-plain-wrap">
         <textarea class="crayon-plain print-no" data-settings="dblclick" readonly="" style="-moz-tab-size:4; -o-tab-size:4; -webkit-tab-size:4; tab-size:4; font-size: 12px !important; line-height: 15px !important;" wrap="soft">
          db.movie.find({title:/.*b$/}).pretty()
         </textarea>
        </div>
        <div class="crayon-main" style="">
         <table class="crayon-table">
          <tbody>
           <tr class="crayon-row">
            <td class="crayon-nums " data-settings="show">
             <div class="crayon-nums-content" style="font-size: 12px !important; line-height: 15px !important;">
              <div class="crayon-num" data-line="crayon-5768647c9c675076354095-1">
               1
              </div>
              <div class="crayon-num crayon-striped-num" data-line="crayon-5768647c9c675076354095-2">
               2
              </div>
             </div>
            </td>
            <td class="crayon-code">
             <div class="crayon-pre" style="font-size: 12px !important; line-height: 15px !important; -moz-tab-size:4; -o-tab-size:4; -webkit-tab-size:4; tab-size:4;">
              <div class="crayon-line" id="crayon-5768647c9c675076354095-1">
               <span class="crayon-v">
                db
               </span>
               <span class="crayon-sy">
                .
               </span>
               <span class="crayon-v">
                movie
               </span>
               <span class="crayon-sy">
                .
               </span>
               <span class="crayon-e">
                find
               </span>
               <span class="crayon-sy">
                (
               </span>
               <span class="crayon-sy">
                {
               </span>
               <span class="crayon-v">
                title
               </span>
               <span class="crayon-o">
                :
               </span>
               <span class="crayon-o">
                /
               </span>
               <span class="crayon-sy">
                .
               </span>
               <span class="crayon-o">
                *
               </span>
               <span class="crayon-v">
                b
               </span>
               <span class="crayon-sy">
                $
               </span>
               <span class="crayon-o">
                /
               </span>
               <span class="crayon-sy">
                }
               </span>
               <span class="crayon-sy">
                )
               </span>
               <span class="crayon-sy">
                .
               </span>
               <span class="crayon-e">
                pretty
               </span>
               <span class="crayon-sy">
                (
               </span>
               <span class="crayon-sy">
                )
               </span>
              </div>
              <div class="crayon-line crayon-striped-line" id="crayon-5768647c9c675076354095-2">
              </div>
             </div>
            </td>
           </tr>
          </tbody>
         </table>
        </div>
       </div>
       <!-- [Format Time: 0.0013 seconds] -->
       <p>
        查找含有’Fight’标题的电影：
       </p>
       <!-- Crayon Syntax Highlighter v_2.7.2_beta -->
       <div class="crayon-syntax crayon-theme-classic crayon-font-monaco crayon-os-pc print-yes notranslate" data-settings=" minimize scroll-mouseover" id="crayon-5768647c9c67b596840446" style=" margin-top: 12px; margin-bottom: 12px; font-size: 12px !important; line-height: 15px !important;">
        <div class="crayon-toolbar" data-settings=" mouseover overlay hide delay" style="font-size: 12px !important;height: 18px !important; line-height: 18px !important;">
         <span class="crayon-title">
         </span>
         <div class="crayon-tools" style="font-size: 12px !important;height: 18px !important; line-height: 18px !important;">
          <div class="crayon-button crayon-nums-button" title="切换是否显示行编号">
           <div class="crayon-button-icon">
           </div>
          </div>
          <div class="crayon-button crayon-plain-button" title="纯文本显示代码">
           <div class="crayon-button-icon">
           </div>
          </div>
          <div class="crayon-button crayon-wrap-button" title="切换自动换行">
           <div class="crayon-button-icon">
           </div>
          </div>
          <div class="crayon-button crayon-expand-button" title="点击展开代码">
           <div class="crayon-button-icon">
           </div>
          </div>
          <div class="crayon-button crayon-copy-button" title="复制代码">
           <div class="crayon-button-icon">
           </div>
          </div>
          <div class="crayon-button crayon-popup-button" title="在新窗口中显示代码">
           <div class="crayon-button-icon">
           </div>
          </div>
         </div>
        </div>
        <div class="crayon-info" style="min-height: 16.8px !important; line-height: 16.8px !important;">
        </div>
        <div class="crayon-plain-wrap">
         <textarea class="crayon-plain print-no" data-settings="dblclick" readonly="" style="-moz-tab-size:4; -o-tab-size:4; -webkit-tab-size:4; tab-size:4; font-size: 12px !important; line-height: 15px !important;" wrap="soft">
          db.movie.find({title:/Fight/}).pretty()
         </textarea>
        </div>
        <div class="crayon-main" style="">
         <table class="crayon-table">
          <tbody>
           <tr class="crayon-row">
            <td class="crayon-nums " data-settings="show">
             <div class="crayon-nums-content" style="font-size: 12px !important; line-height: 15px !important;">
              <div class="crayon-num" data-line="crayon-5768647c9c67b596840446-1">
               1
              </div>
              <div class="crayon-num crayon-striped-num" data-line="crayon-5768647c9c67b596840446-2">
               2
              </div>
             </div>
            </td>
            <td class="crayon-code">
             <div class="crayon-pre" style="font-size: 12px !important; line-height: 15px !important; -moz-tab-size:4; -o-tab-size:4; -webkit-tab-size:4; tab-size:4;">
              <div class="crayon-line" id="crayon-5768647c9c67b596840446-1">
               <span class="crayon-v">
                db
               </span>
               <span class="crayon-sy">
                .
               </span>
               <span class="crayon-v">
                movie
               </span>
               <span class="crayon-sy">
                .
               </span>
               <span class="crayon-e">
                find
               </span>
               <span class="crayon-sy">
                (
               </span>
               <span class="crayon-sy">
                {
               </span>
               <span class="crayon-v">
                title
               </span>
               <span class="crayon-o">
                :
               </span>
               <span class="crayon-o">
                /
               </span>
               <span class="crayon-v">
                Fight
               </span>
               <span class="crayon-o">
                /
               </span>
               <span class="crayon-sy">
                }
               </span>
               <span class="crayon-sy">
                )
               </span>
               <span class="crayon-sy">
                .
               </span>
               <span class="crayon-e">
                pretty
               </span>
               <span class="crayon-sy">
                (
               </span>
               <span class="crayon-sy">
                )
               </span>
              </div>
              <div class="crayon-line crayon-striped-line" id="crayon-5768647c9c67b596840446-2">
              </div>
             </div>
            </td>
           </tr>
          </tbody>
         </table>
        </div>
       </div>
       <!-- [Format Time: 0.0015 seconds] -->
       <p>
        注意以上匹配都是区分大小写的，如果你要让其不区分大小写，则可以：
       </p>
       <!-- Crayon Syntax Highlighter v_2.7.2_beta -->
       <div class="crayon-syntax crayon-theme-classic crayon-font-monaco crayon-os-pc print-yes notranslate" data-settings=" minimize scroll-mouseover" id="crayon-5768647c9c680311330800" style=" margin-top: 12px; margin-bottom: 12px; font-size: 12px !important; line-height: 15px !important;">
        <div class="crayon-toolbar" data-settings=" mouseover overlay hide delay" style="font-size: 12px !important;height: 18px !important; line-height: 18px !important;">
         <span class="crayon-title">
         </span>
         <div class="crayon-tools" style="font-size: 12px !important;height: 18px !important; line-height: 18px !important;">
          <div class="crayon-button crayon-nums-button" title="切换是否显示行编号">
           <div class="crayon-button-icon">
           </div>
          </div>
          <div class="crayon-button crayon-plain-button" title="纯文本显示代码">
           <div class="crayon-button-icon">
           </div>
          </div>
          <div class="crayon-button crayon-wrap-button" title="切换自动换行">
           <div class="crayon-button-icon">
           </div>
          </div>
          <div class="crayon-button crayon-expand-button" title="点击展开代码">
           <div class="crayon-button-icon">
           </div>
          </div>
          <div class="crayon-button crayon-copy-button" title="复制代码">
           <div class="crayon-button-icon">
           </div>
          </div>
          <div class="crayon-button crayon-popup-button" title="在新窗口中显示代码">
           <div class="crayon-button-icon">
           </div>
          </div>
         </div>
        </div>
        <div class="crayon-info" style="min-height: 16.8px !important; line-height: 16.8px !important;">
        </div>
        <div class="crayon-plain-wrap">
         <textarea class="crayon-plain print-no" data-settings="dblclick" readonly="" style="-moz-tab-size:4; -o-tab-size:4; -webkit-tab-size:4; tab-size:4; font-size: 12px !important; line-height: 15px !important;" wrap="soft">
          db.movie.find({title:{$regex:'fight.*b',$options:'$i'}}).pretty()
         </textarea>
        </div>
        <div class="crayon-main" style="">
         <table class="crayon-table">
          <tbody>
           <tr class="crayon-row">
            <td class="crayon-nums " data-settings="show">
             <div class="crayon-nums-content" style="font-size: 12px !important; line-height: 15px !important;">
              <div class="crayon-num" data-line="crayon-5768647c9c680311330800-1">
               1
              </div>
              <div class="crayon-num crayon-striped-num" data-line="crayon-5768647c9c680311330800-2">
               2
              </div>
             </div>
            </td>
            <td class="crayon-code">
             <div class="crayon-pre" style="font-size: 12px !important; line-height: 15px !important; -moz-tab-size:4; -o-tab-size:4; -webkit-tab-size:4; tab-size:4;">
              <div class="crayon-line" id="crayon-5768647c9c680311330800-1">
               <span class="crayon-v">
                db
               </span>
               <span class="crayon-sy">
                .
               </span>
               <span class="crayon-v">
                movie
               </span>
               <span class="crayon-sy">
                .
               </span>
               <span class="crayon-e">
                find
               </span>
               <span class="crayon-sy">
                (
               </span>
               <span class="crayon-sy">
                {
               </span>
               <span class="crayon-v">
                title
               </span>
               <span class="crayon-o">
                :
               </span>
               <span class="crayon-sy">
                {
               </span>
               <span class="crayon-sy">
                $
               </span>
               <span class="crayon-v">
                regex
               </span>
               <span class="crayon-o">
                :
               </span>
               <span class="crayon-s">
                'fight.*b'
               </span>
               <span class="crayon-sy">
                ,
               </span>
               <span class="crayon-sy">
                $
               </span>
               <span class="crayon-v">
                options
               </span>
               <span class="crayon-o">
                :
               </span>
               <span class="crayon-s">
                '$i'
               </span>
               <span class="crayon-sy">
                }
               </span>
               <span class="crayon-sy">
                }
               </span>
               <span class="crayon-sy">
                )
               </span>
               <span class="crayon-sy">
                .
               </span>
               <span class="crayon-e">
                pretty
               </span>
               <span class="crayon-sy">
                (
               </span>
               <span class="crayon-sy">
                )
               </span>
              </div>
              <div class="crayon-line crayon-striped-line" id="crayon-5768647c9c680311330800-2">
              </div>
             </div>
            </td>
           </tr>
          </tbody>
         </table>
        </div>
       </div>
       <!-- [Format Time: 0.0012 seconds] -->
       <p>
        <code>
         $i
        </code>
        是insensitive的意思。这样的话，即使是小写的fight，也能搜到了。
       </p>
       <h4>
        <a class="anchor" href="https://github.com/StevenSLXie/Tutorials-for-Web-Developers/blob/master/MongoDB%20%E6%9E%81%E7%AE%80%E5%AE%9E%E8%B7%B5%E5%85%A5%E9%97%A8.md#15-%E5%90%8E%E8%AE%B0" id="user-content-15-后记">
        </a>
        15. 后记
       </h4>
       <p>
        至此，MongoDB的最基本的内容就介绍得差不多了。如果有什么遗漏的以后我会补上來。如果你一路看到底完全了这个入门教程，恭喜你，你一定是一个有毅力的人。
       </p>
       <p>
        把这个文档过一遍，不会让你变成一个MongoDB的专家(如果会那就太奇怪了)。但如果它能或多或少减少你上手的时间，或者让你意识到“咦，MongoDB其实没那么复杂”，那么这个教程的目的也就达到啦。
       </p>
       <p>
        这个文档是匆忙写就的，出错简直是一定的。如果您发现了任何错误或者有关于本文的任何建议，麻烦发邮件给我（stevenslxie at gmail.com）或者在GitHub上直接交流，不胜感激。
       </p>
       <h4>
        <a class="anchor" href="https://github.com/StevenSLXie/Tutorials-for-Web-Developers/blob/master/MongoDB%20%E6%9E%81%E7%AE%80%E5%AE%9E%E8%B7%B5%E5%85%A5%E9%97%A8.md#%E8%BD%AC%E8%BD%BD%E5%A3%B0%E6%98%8E" id="user-content-转载声明">
        </a>
        转载声明
       </h4>
       <p>
        如果你喜欢这篇文章，可以随意转载。但请
       </p>
       <ul class="task-list">
        <li>
         标明原作者StevenSLXie;
        </li>
        <li>
         标明原链接(
         <a href="https://github.com/StevenSLXie/Tutorials-for-Web-Developers/edit/master/MongoDB%20%E6%9E%81%E7%AE%80%E5%AE%9E%E8%B7%B5%E5%85%A5%E9%97%A8.md">
          https://github.com/StevenSLXie/Tutorials-for-Web-Developers/edit/master/MongoDB%20%E6%9E%81%E7%AE%80%E5%AE%9E%E8%B7%B5%E5%85%A5%E9%97%A8.md
         </a>
         );
        </li>
        <li>
         在可能的情况下请保持文本显示的美观。比如，请不要直接一键复制到博客之类，因为代码的显示效果可能非常糟糕;
        </li>
        <li>
         请将这个转载声明包含进来；
        </li>
       </ul>
      </div>
      <div>
       <strong>
        注：转载文章均来自于公开网络，仅供学习使用，不会用于任何商业用途，如果侵犯到原作者的权益，请您与我们联系删除或者授权事宜，联系邮箱：contact@dataunion.org。转载数盟网站文章请注明原文章作者，否则产生的任何版权纠纷与数盟无关。
       </strong>
      </div>
      <!--content_text-->
      <div class="fenxian">
       <!-- JiaThis Button BEGIN -->
       <div class="jiathis_style_32x32">
        <p class="jiathis_button_weixin">
        </p>
        <p class="jiathis_button_tsina">
        </p>
        <p class="jiathis_button_qzone">
        </p>
        <p class="jiathis_button_cqq">
        </p>
        <p class="jiathis_button_tumblr">
        </p>
        <a class="jiathis jiathis_txt jtico jtico_jiathis" href="http://www.jiathis.com/share" target="_blank">
        </a>
        <p class="jiathis_counter_style">
        </p>
       </div>
       <!-- JiaThis Button END -->
      </div>
     </article>
     <!--content-->
     <!--相关文章-->
     <div class="xianguan">
      <div class="xianguantitle">
       相关文章！
      </div>
      <ul class="pic">
       <li>
        <a href="http://dataunion.org/19988.html">
         <img src="http://dataunion.org/wp-content/uploads/2015/07/mongodb1-750x410_副本.jpg"/>
        </a>
        <a class="link" href="http://dataunion.org/19988.html" rel="bookmark" title="为什么 MongoDB 广受欢迎？这是一个数据结构的问题">
         为什么 MongoDB 广受欢迎？这是一个数据结构的问题
        </a>
       </li>
       <li>
        <a href="http://dataunion.org/19783.html">
         <img src="http://dataunion.org/wp-content/uploads/2015/06/t016576b2f08ab3663b_副本.png"/>
        </a>
        <a class="link" href="http://dataunion.org/19783.html" rel="bookmark" title="为什么MongoDB敢说“做以前你从未能做的事”">
         为什么MongoDB敢说“做以前你从未能做的事”
        </a>
       </li>
       <li>
        <a href="http://dataunion.org/17978.html">
         <img src="http://dataunion.org/wp-content/uploads/2015/05/t018837ed7aceeaac4f_副本-300x188.jpg"/>
        </a>
        <a class="link" href="http://dataunion.org/17978.html" rel="bookmark" title="视觉中国的NoSQL之路：从MySQL到MongoDB">
         视觉中国的NoSQL之路：从MySQL到MongoDB
        </a>
       </li>
       <li>
        <a href="http://dataunion.org/14652.html">
         <img src="http://dataunion.org/wp-content/uploads/2015/04/t01d2bcf47ffa0af5f8-300x232.png"/>
        </a>
        <a class="link" href="http://dataunion.org/14652.html" rel="bookmark" title="开发高性能的MongoDB应用：浅谈MongoDB性能优化">
         开发高性能的MongoDB应用：浅谈MongoDB性能优化
        </a>
       </li>
      </ul>
     </div>
     <!--相关文章-->
     <div class="comment" id="comments">
      <!-- You can start editing here. -->
      <!-- If comments are open, but there are no comments. -->
      <div class="title">
       期待你一针见血的评论，Come on！
      </div>
      <div id="respond">
       <p>
        不用想啦，马上
        <a href="http://dataunion.org/wp-login.php?redirect_to=http%3A%2F%2Fdataunion.org%2F5572.html">
         "登录"
        </a>
        发表自已的想法.
       </p>
      </div>
     </div>
     <!-- .nav-single -->
    </div>
    <!--Container End-->
    <aside id="sitebar">
     <div class="sitebar_list2">
      <div class="wptag">
       <span class="tagtitle">
        热门标签+
       </span>
       <div class="tagg">
        <ul class="menu" id="menu-%e5%8f%8b%e6%83%85%e9%93%be%e6%8e%a5">
         <li class="menu-item menu-item-type-custom menu-item-object-custom menu-item-1605" id="menu-item-1605">
          <a href="http://taidizh.com/">
           泰迪智慧
          </a>
         </li>
         <li class="menu-item menu-item-type-custom menu-item-object-custom menu-item-20884" id="menu-item-20884">
          <a href="http://www.transwarp.cn/">
           星环科技
          </a>
         </li>
         <li class="menu-item menu-item-type-custom menu-item-object-custom menu-item-3538" id="menu-item-3538">
          <a href="http://datall.org/">
           珈和遥感
          </a>
         </li>
         <li class="menu-item menu-item-type-custom menu-item-object-custom menu-item-20888" id="menu-item-20888">
          <a href="http://www.chinahadoop.cn/">
           小象学院
          </a>
         </li>
        </ul>
       </div>
      </div>
     </div>
     <div class="sitebar_list">
      <div class="textwidget">
       <div align="center">
        <a href="http://study.163.com/course/courseMain.htm?courseId=991022" target="_blank">
         <img src="http://dataunion.org/wp-content/uploads/2016/03/dv.jpg"/>
        </a>
       </div>
      </div>
     </div>
     <div class="sitebar_list">
      <h4 class="sitebar_title">
       文章分类
      </h4>
      <div class="tagcloud">
       <a class="tag-link-44" href="http://dataunion.org/category/industry/demo" style="font-size: 10.204724409449pt;" title="4个话题">
        Demo展示
       </a>
       <a class="tag-link-31" href="http://dataunion.org/category/experts" style="font-size: 15.826771653543pt;" title="52个话题">
        专家团队
       </a>
       <a class="tag-link-870" href="http://dataunion.org/category/tech/ai" style="font-size: 19.795275590551pt;" title="273个话题">
        人工智能
       </a>
       <a class="tag-link-488" href="http://dataunion.org/category/%e5%8a%a0%e5%85%a5%e6%95%b0%e7%9b%9f" style="font-size: 8pt;" title="1个话题">
        加入数盟
       </a>
       <a class="tag-link-869" href="http://dataunion.org/category/tech/viz" style="font-size: 17.204724409449pt;" title="93个话题">
        可视化
       </a>
       <a class="tag-link-30" href="http://dataunion.org/category/partners" style="font-size: 10.645669291339pt;" title="5个话题">
        合作伙伴
       </a>
       <a class="tag-link-889" href="http://dataunion.org/category/parterc" style="font-size: 11.582677165354pt;" title="8个话题">
        合作会议
       </a>
       <a class="tag-link-104" href="http://dataunion.org/category/books" style="font-size: 12.96062992126pt;" title="15个话题">
        图书
       </a>
       <a class="tag-link-220" href="http://dataunion.org/category/tech/base" style="font-size: 19.850393700787pt;" title="281个话题">
        基础架构
       </a>
       <a class="tag-link-219" href="http://dataunion.org/category/tech/analysis" style="font-size: 19.409448818898pt;" title="232个话题">
        数据分析
       </a>
       <a class="tag-link-887" href="http://dataunion.org/category/tech/dm" style="font-size: 13.291338582677pt;" title="17个话题">
        数据挖掘
       </a>
       <a class="tag-link-34" href="http://dataunion.org/category/tech" style="font-size: 20.732283464567pt;" title="404个话题">
        文章
       </a>
       <a class="tag-link-1" href="http://dataunion.org/category/uncategorized" style="font-size: 22pt;" title="693个话题">
        未分类
       </a>
       <a class="tag-link-4" href="http://dataunion.org/category/events" style="font-size: 14.503937007874pt;" title="29个话题">
        活动
       </a>
       <a class="tag-link-890" href="http://dataunion.org/category/tech/%e6%b7%b1%e5%ba%a6%e5%ad%a6%e4%b9%a0" style="font-size: 10.204724409449pt;" title="4个话题">
        深度学习
       </a>
       <a class="tag-link-221" href="http://dataunion.org/category/tech/devl" style="font-size: 18.968503937008pt;" title="193个话题">
        编程语言
       </a>
       <a class="tag-link-888" href="http://dataunion.org/category/career" style="font-size: 15.661417322835pt;" title="48个话题">
        职业规划
       </a>
       <a class="tag-link-5" href="http://dataunion.org/category/jobs" style="font-size: 14.11811023622pt;" title="25个话题">
        职位
       </a>
       <a class="tag-link-871" href="http://dataunion.org/category/industry" style="font-size: 15.716535433071pt;" title="49个话题">
        行业
       </a>
       <a class="tag-link-613" href="http://dataunion.org/category/industry/case" style="font-size: 16.984251968504pt;" title="84个话题">
        行业应用
       </a>
       <a class="tag-link-885" href="http://dataunion.org/category/industry/news" style="font-size: 17.425196850394pt;" title="102个话题">
        行业资讯
       </a>
       <a class="tag-link-10" href="http://dataunion.org/category/training" style="font-size: 14.228346456693pt;" title="26个话题">
        课程
       </a>
       <a class="tag-link-16" href="http://dataunion.org/category/sources" style="font-size: 15.661417322835pt;" title="48个话题">
        资源
       </a>
      </div>
     </div>
     <div class="sitebar_list">
      <h4 class="sitebar_title">
       功能
      </h4>
      <ul>
       <li>
        <a href="http://dataunion.org/wp-login.php?action=register">
         注册
        </a>
       </li>
       <li>
        <a href="http://dataunion.org/wp-login.php">
         登录
        </a>
       </li>
       <li>
        <a href="http://dataunion.org/feed">
         文章
         <abbr title="Really Simple Syndication">
          RSS
         </abbr>
        </a>
       </li>
       <li>
        <a href="http://dataunion.org/comments/feed">
         评论
         <abbr title="Really Simple Syndication">
          RSS
         </abbr>
        </a>
       </li>
       <li>
        <a href="https://cn.wordpress.org/" title="基于WordPress，一个优美、先进的个人信息发布平台。">
         WordPress.org
        </a>
       </li>
      </ul>
     </div>
    </aside>
    <div class="clear">
    </div>
   </div>
   <!--main-->
   ﻿
   <footer id="dibu">
    <div class="about">
     <div class="right">
      <ul class="menu" id="menu-%e5%ba%95%e9%83%a8%e8%8f%9c%e5%8d%95">
       <li class="menu-item menu-item-type-taxonomy menu-item-object-category menu-item-18024" id="menu-item-18024">
        <a href="http://dataunion.org/category/partners">
         合作伙伴
        </a>
       </li>
       <li class="menu-item menu-item-type-post_type menu-item-object-page menu-item-20881" id="menu-item-20881">
        <a href="http://dataunion.org/contribute">
         文章投稿
        </a>
       </li>
       <li class="menu-item menu-item-type-taxonomy menu-item-object-category menu-item-20872" id="menu-item-20872">
        <a href="http://dataunion.org/category/%e5%8a%a0%e5%85%a5%e6%95%b0%e7%9b%9f">
         加入数盟
        </a>
       </li>
       <li class="menu-item menu-item-type-post_type menu-item-object-page menu-item-22441" id="menu-item-22441">
        <a href="http://dataunion.org/f-links">
         友情链接
        </a>
       </li>
       <li class="menu-item menu-item-type-post_type menu-item-object-page menu-item-20874" id="menu-item-20874">
        <a href="http://dataunion.org/aboutus">
         关于数盟
        </a>
       </li>
      </ul>
      <p class="banquan">
       数盟社区        ，
        做最棒的数据科学社区
      </p>
     </div>
     <div class="left">
      <ul class="bottomlist">
       <li>
        <a href="http://weibo.com/DataScientistUnion  " target="_blank" 　title="">
         <img src="http://dataunion.org/wp-content/themes/yzipi/images/weibo.png"/>
        </a>
       </li>
       <li>
        <a class="cd-popup-trigger" href="http://dataunion.org/5572.html#0">
         <img src="http://dataunion.org/wp-content/themes/yzipi/images/weixin.png"/>
        </a>
       </li>
      </ul>
      <div class="cd-popup">
       <div class="cd-popup-container">
        <h1>
         扫描二维码,加微信公众号
        </h1>
        <img src="http://dataunion.org/wp-content/themes/yzipi/images/2014-12-06-1515289049.png"/>
        <a class="cd-popup-close" href="http://dataunion.org/5572.html">
        </a>
       </div>
       <!-- cd-popup-container -->
      </div>
      <!-- cd-popup -->
     </div>
    </div>
    <!--about-->
    <div class="bottom">
     <a href="http://dataunion.org/">
      数盟社区
     </a>
     <a href="http://www.miitbeian.gov.cn/" rel="external nofollow" target="_blank">
      京ICP备14026740号
     </a>
     联系我们：
     <a href="mailto:contact@dataunion.org" target="_blank">
      contact@dataunion.org
     </a>
     <div class="tongji">
     </div>
     <!--bottom-->
     <div class="scroll" id="scroll" style="display:none;">
      ︿
     </div>
    </div>
   </footer>
   <!--dibu-->
  </div>
 </body>
</html>